lws 8.1.0 → 9.0.0.beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/lws/version.rb +1 -1
- metadata +21 -65
- data/test/api_token_middleware_test.rb +0 -59
- data/test/auth_test.rb +0 -190
- data/test/caching_test.rb +0 -65
- data/test/config/empty.yml +0 -2
- data/test/config/endpoints.yml +0 -4
- data/test/config/full.yml +0 -16
- data/test/config/invalid.yml +0 -3
- data/test/config/switch_env.yml +0 -3
- data/test/config/tokens.yml +0 -3
- data/test/corporate_website_test.rb +0 -113
- data/test/digital_signage_test.rb +0 -980
- data/test/fixtures/auth.yml +0 -73
- data/test/fixtures/permissions.yml +0 -27
- data/test/generic_test.rb +0 -179
- data/test/http_caching_test.rb +0 -82
- data/test/json_parser_test.rb +0 -92
- data/test/logger_test.rb +0 -36
- data/test/maps_test.rb +0 -78
- data/test/presence_test.rb +0 -205
- data/test/resource_test.rb +0 -91
- data/test/setup_test.rb +0 -177
- data/test/stubbing_test.rb +0 -74
- data/test/support/with_env.rb +0 -25
- data/test/test_helper.rb +0 -77
- data/test/ticket_test.rb +0 -131
data/test/fixtures/auth.yml
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
auth:
|
2
|
-
/tokens/test:
|
3
|
-
default: &token_test
|
4
|
-
id: 1
|
5
|
-
token: test
|
6
|
-
account_id: 1
|
7
|
-
device_id: null
|
8
|
-
user_id: 1
|
9
|
-
|
10
|
-
/tokens/test_device:
|
11
|
-
default:
|
12
|
-
id: 1
|
13
|
-
token: test_device
|
14
|
-
account_id: 1
|
15
|
-
device_id: 1
|
16
|
-
user_id: null
|
17
|
-
|
18
|
-
/tokens/does_not_exist:
|
19
|
-
default:
|
20
|
-
errors:
|
21
|
-
base:
|
22
|
-
- "Not found (HTTP 404)"
|
23
|
-
|
24
|
-
/tokens:
|
25
|
-
default:
|
26
|
-
- *token_test
|
27
|
-
post_default: *token_test
|
28
|
-
|
29
|
-
/accounts/1:
|
30
|
-
default: &account_1
|
31
|
-
id: 1
|
32
|
-
company_id: 1
|
33
|
-
manages_company_ids: [1]
|
34
|
-
language: nl
|
35
|
-
devices: []
|
36
|
-
|
37
|
-
/accounts:
|
38
|
-
default:
|
39
|
-
- *account_1
|
40
|
-
post_default: *account_1
|
41
|
-
|
42
|
-
/accounts/1/devices/1:
|
43
|
-
default: &device_1
|
44
|
-
id: 1
|
45
|
-
account_id: 1
|
46
|
-
name: Test Device
|
47
|
-
|
48
|
-
/accounts/1/devices:
|
49
|
-
default:
|
50
|
-
- *device_1
|
51
|
-
post_default: *device_1
|
52
|
-
|
53
|
-
/accounts/1/users/1:
|
54
|
-
default: &user_1
|
55
|
-
id: 1
|
56
|
-
account_id: 1
|
57
|
-
email: test.user@leftclick.eu
|
58
|
-
|
59
|
-
/accounts/1/users:
|
60
|
-
default:
|
61
|
-
- *user_1
|
62
|
-
post_default: *user_1
|
63
|
-
|
64
|
-
/companies/1:
|
65
|
-
default: &company_1
|
66
|
-
id: 1
|
67
|
-
contact_person_id: 1
|
68
|
-
parent_id: null
|
69
|
-
|
70
|
-
/companies:
|
71
|
-
default:
|
72
|
-
- *company_1
|
73
|
-
post_default: *company_1
|
@@ -1,27 +0,0 @@
|
|
1
|
-
auth:
|
2
|
-
/accounts/1/apps:
|
3
|
-
default:
|
4
|
-
- id: 1
|
5
|
-
app_key: rails-skel
|
6
|
-
permissions:
|
7
|
-
- key: configuration.read
|
8
|
-
value: "true"
|
9
|
-
- key: configuration.write
|
10
|
-
value: "true"
|
11
|
-
generic:
|
12
|
-
- id: 1
|
13
|
-
app_key: test
|
14
|
-
permissions:
|
15
|
-
- key: test.flag
|
16
|
-
value: "true"
|
17
|
-
- key: test.select
|
18
|
-
value: 1
|
19
|
-
- key: test.custom_select
|
20
|
-
value: "yes"
|
21
|
-
- key: test.multi_select
|
22
|
-
value: [1, 2]
|
23
|
-
no_apps: []
|
24
|
-
no_perms:
|
25
|
-
- id: 1
|
26
|
-
app_key: rails-skel
|
27
|
-
permissions: []
|
data/test/generic_test.rb
DELETED
@@ -1,179 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright © 2016–2021 LeftClick Web Services B.V.
|
3
|
-
#
|
4
|
-
# This software is property of LeftClick Web Services B.V. and cannot be
|
5
|
-
# redistributed and/or modified without permission. The software or any
|
6
|
-
# of its parts cannot be used for any other purposes than the LeftClick
|
7
|
-
# services and only during a valid license subscription. For more
|
8
|
-
# information, please contact LeftClick Web Services B.V. at:
|
9
|
-
# Schootense Dreef 20A, 5708 HZ Helmond, The Netherlands,
|
10
|
-
# info@leftclick.eu, +3185-4444-004.
|
11
|
-
|
12
|
-
|
13
|
-
require "test_helper"
|
14
|
-
|
15
|
-
class TestGenericModel < MiniTest::Test
|
16
|
-
|
17
|
-
# Generic models needs to be accessed as under some kind of app
|
18
|
-
include LWS::Auth
|
19
|
-
|
20
|
-
def setup
|
21
|
-
@configuration = Configuration.find(1)
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_her_compatibility
|
25
|
-
@configuration.assign_attributes("value" => "other_value")
|
26
|
-
assert_equal("other_value", @configuration.value)
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_not_found
|
30
|
-
assert_raises LWS::Errors::ResourceNotFound do
|
31
|
-
Configuration.find("NOTEXIST")
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_lifecycle
|
36
|
-
# Create
|
37
|
-
new_configuration = Configuration.create(key: "test", value: "some_value")
|
38
|
-
refute_nil(new_configuration)
|
39
|
-
assert_instance_of(Configuration, new_configuration)
|
40
|
-
|
41
|
-
# Retrieve
|
42
|
-
new_configuration = Configuration.find(new_configuration.id)
|
43
|
-
refute_nil(new_configuration)
|
44
|
-
assert_instance_of(Configuration, new_configuration)
|
45
|
-
assert_raises LWS::Errors::ResourceNotFound do
|
46
|
-
Configuration.find("does_not_exist")
|
47
|
-
end
|
48
|
-
|
49
|
-
# Update
|
50
|
-
new_configuration.value = "other_value"
|
51
|
-
assert(new_configuration.save)
|
52
|
-
new_configuration.reload
|
53
|
-
assert_equal("other_value", new_configuration.value)
|
54
|
-
|
55
|
-
# Destroy
|
56
|
-
assert(new_configuration.destroy)
|
57
|
-
assert_raises LWS::Errors::ResourceNotFound do
|
58
|
-
Configuration.find(new_configuration.id)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
def test_dirty
|
63
|
-
# Always save a non-persisted object (even without changes)
|
64
|
-
configuration = Configuration.new
|
65
|
-
assert_empty(configuration.changes)
|
66
|
-
configuration.save
|
67
|
-
refute_empty(configuration.errors.messages)
|
68
|
-
|
69
|
-
# No changes for a just found instance
|
70
|
-
configuration = Configuration.find(@configuration.id)
|
71
|
-
refute(configuration.changed?)
|
72
|
-
assert_equal({}, configuration.changes)
|
73
|
-
|
74
|
-
# Changes when an attribute is changed
|
75
|
-
configuration.value = "other_value"
|
76
|
-
assert(configuration.changed?)
|
77
|
-
assert_equal({ "value" => ["test_value", "other_value"] },
|
78
|
-
configuration.changes)
|
79
|
-
|
80
|
-
# Changes reverted when rolled back
|
81
|
-
configuration.rollback
|
82
|
-
refute(configuration.changed?)
|
83
|
-
assert_equal({}, configuration.changes)
|
84
|
-
|
85
|
-
# Changes overwritten when reloaded
|
86
|
-
configuration.value = "other_value"
|
87
|
-
assert(configuration.changed?)
|
88
|
-
configuration.reload
|
89
|
-
refute(configuration.changed?)
|
90
|
-
assert_equal({}, configuration.changes)
|
91
|
-
|
92
|
-
# Not committed to the API if not changed
|
93
|
-
refute(configuration.changed?)
|
94
|
-
result = configuration.save
|
95
|
-
assert_equal(true, result)
|
96
|
-
end
|
97
|
-
|
98
|
-
def test_dig
|
99
|
-
company = LWS::Auth::Company.find(1)
|
100
|
-
assert_equal(company.id, company.dig(:id))
|
101
|
-
|
102
|
-
assert_equal(company.contact_person.name, company.dig(:contact_person, :name))
|
103
|
-
assert_nil(company.dig(:parent, :name))
|
104
|
-
|
105
|
-
assert_raises(TypeError) do
|
106
|
-
company.dig(:id, :foo)
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
def test_deep_dup
|
111
|
-
company = LWS::Auth::Company.find(1)
|
112
|
-
company_dup = company.deep_dup
|
113
|
-
|
114
|
-
# The object itself
|
115
|
-
refute_equal(company.object_id, company_dup.object_id)
|
116
|
-
# An object as attribute value
|
117
|
-
refute_equal(company.address.object_id, company_dup.address.object_id)
|
118
|
-
# A related object
|
119
|
-
refute_equal(company.contact_person.object_id, company_dup.contact_person.object_id)
|
120
|
-
# An item in array of related objects
|
121
|
-
refute_equal(company.accounts.first.object_id, company_dup.accounts.first.object_id)
|
122
|
-
end
|
123
|
-
|
124
|
-
end
|
125
|
-
|
126
|
-
class TestGenericConfiguration < MiniTest::Test
|
127
|
-
|
128
|
-
# Generic class needs to be accessed under some kind of app
|
129
|
-
include LWS::Auth
|
130
|
-
|
131
|
-
def setup
|
132
|
-
@configuration = Configuration.find(1)
|
133
|
-
end
|
134
|
-
|
135
|
-
def test_valid
|
136
|
-
refute_nil(@configuration)
|
137
|
-
assert_instance_of(Configuration, @configuration)
|
138
|
-
refute_nil(@configuration.id)
|
139
|
-
end
|
140
|
-
|
141
|
-
end
|
142
|
-
|
143
|
-
class TestGenericStorage < MiniTest::Test
|
144
|
-
|
145
|
-
# Generic class needs to be accessed under some kind of app
|
146
|
-
include LWS::Presence
|
147
|
-
|
148
|
-
def test_upload
|
149
|
-
data = StringIO.new("some file contents\n")
|
150
|
-
refute_nil(Storage.upload(data, "test.txt", "text/plain"))
|
151
|
-
|
152
|
-
# Test the deprecated method (for now)
|
153
|
-
refute_nil(Storage.create(data, "test.txt", "text/plain"))
|
154
|
-
|
155
|
-
# Also test using the default HTTP adapter.
|
156
|
-
reconfigure(http_persistent: false)
|
157
|
-
data = StringIO.new("some more file contents\n")
|
158
|
-
refute_nil(Storage.upload(data, "test2.txt", "text/plain"))
|
159
|
-
end
|
160
|
-
|
161
|
-
def test_download
|
162
|
-
location = Location.find(1)
|
163
|
-
refute_nil(location.image_url)
|
164
|
-
|
165
|
-
data = Storage.download(location.image_url)
|
166
|
-
assert(data.size > 0)
|
167
|
-
|
168
|
-
assert_nil(Storage.download(nil))
|
169
|
-
|
170
|
-
assert_raises(ArgumentError) do
|
171
|
-
Storage.download("https://doesnot.exist.tld/some/file")
|
172
|
-
end
|
173
|
-
|
174
|
-
# Also test using the default HTTP adapter.
|
175
|
-
reconfigure(http_persistent: false)
|
176
|
-
data = Storage.download(location.image_url)
|
177
|
-
assert(data.size > 0)
|
178
|
-
end
|
179
|
-
end
|
data/test/http_caching_test.rb
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright © 2016–2021 LeftClick Web Services B.V.
|
3
|
-
#
|
4
|
-
# This software is property of LeftClick Web Services B.V. and cannot be
|
5
|
-
# redistributed and/or modified without permission. The software or any
|
6
|
-
# of its parts cannot be used for any other purposes than the LeftClick
|
7
|
-
# services and only during a valid license subscription. For more
|
8
|
-
# information, please contact LeftClick Web Services B.V. at:
|
9
|
-
# Schootense Dreef 20A, 5708 HZ Helmond, The Netherlands,
|
10
|
-
# info@leftclick.eu, +3185-4444-004.
|
11
|
-
|
12
|
-
|
13
|
-
require "test_helper"
|
14
|
-
|
15
|
-
class TestHTTPCaching < MiniTest::Test
|
16
|
-
|
17
|
-
# Class used to check if data is read/written to or remove from the cache
|
18
|
-
class HTTPCacheTest
|
19
|
-
|
20
|
-
attr_reader :last_read_key
|
21
|
-
attr_reader :last_written_key, :last_written_value
|
22
|
-
attr_reader :last_deleted_key
|
23
|
-
|
24
|
-
def read(key)
|
25
|
-
@last_read_key = key
|
26
|
-
nil
|
27
|
-
end
|
28
|
-
|
29
|
-
def write(key, value)
|
30
|
-
@last_written_key = key
|
31
|
-
@last_written_value = value
|
32
|
-
nil
|
33
|
-
end
|
34
|
-
|
35
|
-
def delete(key)
|
36
|
-
@last_deleted_key = key
|
37
|
-
nil
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
41
|
-
|
42
|
-
def setup
|
43
|
-
@cache_mock = HTTPCacheTest.new
|
44
|
-
|
45
|
-
# Redo the LWS setup with an HTTP caching object
|
46
|
-
LWS.setup do |config|
|
47
|
-
config.api_token = ENV["LC_LWS_TEST_TOKEN"]
|
48
|
-
config.http_caching = true
|
49
|
-
config.http_caching_object = @cache_mock
|
50
|
-
if ENV["LC_LWS_TEST_DEBUG"].present?
|
51
|
-
config.http_debug = true
|
52
|
-
config.http_debug_headers = true
|
53
|
-
end
|
54
|
-
config.environment = :development
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
def teardown
|
59
|
-
# Restore the configuration
|
60
|
-
reconfigure
|
61
|
-
end
|
62
|
-
|
63
|
-
def test_working_cache
|
64
|
-
assert_nil(@cache_mock.last_read_key)
|
65
|
-
assert_nil(@cache_mock.last_written_key)
|
66
|
-
assert_nil(@cache_mock.last_written_value)
|
67
|
-
assert_nil(@cache_mock.last_deleted_key)
|
68
|
-
|
69
|
-
new_configuration = LWS::Auth::Configuration.create(key: "test", value: "some_value")
|
70
|
-
refute_nil(@cache_mock.last_deleted_key)
|
71
|
-
|
72
|
-
_configurations = LWS::Auth::Configuration.where(key: "test").to_a
|
73
|
-
refute_nil(@cache_mock.last_read_key)
|
74
|
-
assert_equal(@cache_mock.last_read_key, @cache_mock.last_written_key)
|
75
|
-
refute_nil(@cache_mock.last_written_value)
|
76
|
-
|
77
|
-
old_key = @cache_mock.last_deleted_key.dup
|
78
|
-
new_configuration.destroy
|
79
|
-
refute_equal(old_key, @cache_mock.last_deleted_key)
|
80
|
-
end
|
81
|
-
|
82
|
-
end
|
data/test/json_parser_test.rb
DELETED
@@ -1,92 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright © 2016–2021 LeftClick Web Services B.V.
|
3
|
-
#
|
4
|
-
# This software is property of LeftClick Web Services B.V. and cannot be
|
5
|
-
# redistributed and/or modified without permission. The software or any
|
6
|
-
# of its parts cannot be used for any other purposes than the LeftClick
|
7
|
-
# services and only during a valid license subscription. For more
|
8
|
-
# information, please contact LeftClick Web Services B.V. at:
|
9
|
-
# Schootense Dreef 20A, 5708 HZ Helmond, The Netherlands,
|
10
|
-
# info@leftclick.eu, +3185-4444-004.
|
11
|
-
|
12
|
-
|
13
|
-
require "test_helper"
|
14
|
-
|
15
|
-
class TestJSONParser < MiniTest::Test
|
16
|
-
|
17
|
-
include WebMock::API
|
18
|
-
|
19
|
-
def setup
|
20
|
-
# Redo LWS setup with persistent HTTP connections disabled.
|
21
|
-
reconfigure(http_persistent: false)
|
22
|
-
WebMock.enable!
|
23
|
-
company = { data:
|
24
|
-
{ id: "correct",
|
25
|
-
country: "NL",
|
26
|
-
# ...
|
27
|
-
} }
|
28
|
-
companies = [ { id: "correct",
|
29
|
-
country: "NL",
|
30
|
-
# ...
|
31
|
-
} ]
|
32
|
-
|
33
|
-
full_uri = LWS::Auth.api.url_prefix.dup
|
34
|
-
full_uri.path = "/companies/broken"
|
35
|
-
stub_request(:get, full_uri.to_s).to_return(body: "{}invalid json")
|
36
|
-
full_uri.path = "/companies/noobj"
|
37
|
-
stub_request(:get, full_uri.to_s).to_return(body: "\"str\"")
|
38
|
-
full_uri.path = "/companies/empty"
|
39
|
-
stub_request(:get, full_uri.to_s).to_return(body: "")
|
40
|
-
full_uri.path = "/companies/correct"
|
41
|
-
stub_request(:get, full_uri.to_s)
|
42
|
-
.to_return(body: MultiJson.dump(company))
|
43
|
-
stub_request(:put, full_uri.to_s)
|
44
|
-
.to_return(body: MultiJson.dump(company.merge(errors: { contact_person_id: ["can't be blank"] })))
|
45
|
-
full_uri.path = "/companies"
|
46
|
-
stub_request(:get, full_uri.to_s)
|
47
|
-
.to_return(body: MultiJson.dump(companies))
|
48
|
-
stub_request(:post, full_uri.to_s)
|
49
|
-
.to_return(body: "", status: 204)
|
50
|
-
end
|
51
|
-
|
52
|
-
def teardown
|
53
|
-
WebMock.disable!
|
54
|
-
reconfigure
|
55
|
-
end
|
56
|
-
|
57
|
-
def test_broken_json
|
58
|
-
assert_raises LWS::Errors::InvalidResponse do
|
59
|
-
company = LWS::Auth::Company.find("broken")
|
60
|
-
end
|
61
|
-
|
62
|
-
assert_raises LWS::Errors::InvalidResponse do
|
63
|
-
company = LWS::Auth::Company.find("noobj")
|
64
|
-
end
|
65
|
-
|
66
|
-
assert_raises LWS::Errors::InvalidResponse do
|
67
|
-
company = LWS::Auth::Company.find("empty")
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
def test_correct_json
|
72
|
-
company = LWS::Auth::Company.find("correct")
|
73
|
-
assert_equal "correct", company.id
|
74
|
-
end
|
75
|
-
def test_correct_json_ary
|
76
|
-
companies = LWS::Auth::Company.all.to_a
|
77
|
-
assert_equal "correct", companies.first.id
|
78
|
-
end
|
79
|
-
|
80
|
-
def test_no_content_json
|
81
|
-
company = LWS::Auth::Company.create
|
82
|
-
assert_instance_of LWS::Auth::Company, company
|
83
|
-
end
|
84
|
-
|
85
|
-
def test_correct_json_with_errors
|
86
|
-
company = LWS::Auth::Company.find("correct")
|
87
|
-
company.contact_person_id = ""
|
88
|
-
company.save
|
89
|
-
assert_equal ["Contact person can't be blank"], company.errors.to_a
|
90
|
-
end
|
91
|
-
|
92
|
-
end
|
data/test/logger_test.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright © 2016–2021 LeftClick Web Services B.V.
|
3
|
-
#
|
4
|
-
# This software is property of LeftClick Web Services B.V. and cannot be
|
5
|
-
# redistributed and/or modified without permission. The software or any
|
6
|
-
# of its parts cannot be used for any other purposes than the LeftClick
|
7
|
-
# services and only during a valid license subscription. For more
|
8
|
-
# information, please contact LeftClick Web Services B.V. at:
|
9
|
-
# Schootense Dreef 20A, 5708 HZ Helmond, The Netherlands,
|
10
|
-
# info@leftclick.eu, +3185-4444-004.
|
11
|
-
|
12
|
-
|
13
|
-
require "test_helper"
|
14
|
-
|
15
|
-
class TestLogger < MiniTest::Test
|
16
|
-
|
17
|
-
def test_working_logger
|
18
|
-
log = StringIO.new
|
19
|
-
logger = Logger.new(log)
|
20
|
-
logger.level = Logger::DEBUG
|
21
|
-
|
22
|
-
# Configure the logger and enable HTTP request and JSON data debugging
|
23
|
-
reconfigure(logger: logger,
|
24
|
-
http_debug: true,
|
25
|
-
http_debug_headers: true,
|
26
|
-
json_debug: true)
|
27
|
-
|
28
|
-
# Perform a query to have any log entries
|
29
|
-
LWS::Auth::Token.all.first
|
30
|
-
refute_nil(log.string)
|
31
|
-
|
32
|
-
# Restore the token
|
33
|
-
reconfigure
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
data/test/maps_test.rb
DELETED
@@ -1,78 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright © 2016–2021 LeftClick Web Services B.V.
|
3
|
-
#
|
4
|
-
# This software is property of LeftClick Web Services B.V. and cannot be
|
5
|
-
# redistributed and/or modified without permission. The software or any
|
6
|
-
# of its parts cannot be used for any other purposes than the LeftClick
|
7
|
-
# services and only during a valid license subscription. For more
|
8
|
-
# information, please contact LeftClick Web Services B.V. at:
|
9
|
-
# Schootense Dreef 20A, 5708 HZ Helmond, The Netherlands,
|
10
|
-
# info@leftclick.eu, +3185-4444-004.
|
11
|
-
|
12
|
-
|
13
|
-
require "test_helper"
|
14
|
-
|
15
|
-
class TestMapsMap < MiniTest::Test
|
16
|
-
|
17
|
-
include LWS::Maps
|
18
|
-
|
19
|
-
def setup
|
20
|
-
@map = Map.find(1)
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_valid_map
|
24
|
-
refute_nil(@map)
|
25
|
-
assert_instance_of(Map, @map)
|
26
|
-
refute_nil(@map.id)
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_valid_map_associations
|
30
|
-
assert_instance_of(LWS::Auth::Company, @map.company)
|
31
|
-
assert_instance_of(Marker, @map.markers.first)
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
35
|
-
|
36
|
-
class TestMapsMarker < MiniTest::Test
|
37
|
-
|
38
|
-
include LWS::Maps
|
39
|
-
|
40
|
-
def setup
|
41
|
-
@map = Map.find(1)
|
42
|
-
# Markers only exist as child objects of maps
|
43
|
-
@marker = @map.markers.first
|
44
|
-
end
|
45
|
-
|
46
|
-
def test_valid_map
|
47
|
-
refute_nil(@marker)
|
48
|
-
assert_instance_of(Marker, @marker)
|
49
|
-
refute_nil(@marker.id)
|
50
|
-
end
|
51
|
-
|
52
|
-
def test_valid_map_associations
|
53
|
-
assert_instance_of(Map, @marker.map)
|
54
|
-
assert_equal(@map, @marker.map)
|
55
|
-
end
|
56
|
-
|
57
|
-
end
|
58
|
-
|
59
|
-
class TestMapsSource < MiniTest::Test
|
60
|
-
|
61
|
-
include LWS::Maps
|
62
|
-
|
63
|
-
def setup
|
64
|
-
@source = Source.find(1)
|
65
|
-
end
|
66
|
-
|
67
|
-
def test_valid_source
|
68
|
-
refute_nil(@source)
|
69
|
-
assert_instance_of(Source, @source)
|
70
|
-
refute_nil(@source.id)
|
71
|
-
end
|
72
|
-
|
73
|
-
def test_valid_source_associations
|
74
|
-
# FIXME: Not implemented yet
|
75
|
-
#assert_instance_of(Map, @source.maps.first)
|
76
|
-
end
|
77
|
-
|
78
|
-
end
|