rosemary 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.ruby-version +1 -1
- data/.travis.yml +4 -0
- data/lib/rosemary/api.rb +5 -4
- data/lib/rosemary/version.rb +1 -1
- data/spec/integration/changeset_spec.rb +23 -18
- data/spec/integration/node_spec.rb +54 -54
- data/spec/integration/note_spec.rb +6 -6
- data/spec/integration/user_spec.rb +3 -3
- data/spec/integration/way_spec.rb +2 -2
- data/spec/models/changeset_spec.rb +20 -20
- data/spec/models/node_spec.rb +33 -33
- data/spec/models/parser_spec.rb +6 -6
- data/spec/models/relation_spec.rb +10 -10
- data/spec/models/way_spec.rb +26 -26
- data/spec/spec_helper.rb +3 -3
- metadata +31 -4
- checksums.yaml +0 -15
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.9.3-
|
1
|
+
1.9.3-p547
|
data/.travis.yml
CHANGED
data/lib/rosemary/api.rb
CHANGED
@@ -73,8 +73,8 @@ module Rosemary
|
|
73
73
|
#
|
74
74
|
# call-seq: find_or_create_open_changeset(id, comment) -> Rosemary::Changeset
|
75
75
|
#
|
76
|
-
def find_or_create_open_changeset(id, comment = nil)
|
77
|
-
find_open_changeset(id) || create_changeset(comment)
|
76
|
+
def find_or_create_open_changeset(id, comment = nil, tags = {})
|
77
|
+
find_open_changeset(id) || create_changeset(comment, tags)
|
78
78
|
end
|
79
79
|
|
80
80
|
def find_open_changeset(id)
|
@@ -150,8 +150,9 @@ module Rosemary
|
|
150
150
|
# @param [String] comment a meaningful comment for this changeset
|
151
151
|
# @return [Rosemary::Changeset] the changeset which was newly created
|
152
152
|
# @raise [Rosemary::NotFound] in case the changeset could not be found
|
153
|
-
def create_changeset(comment = nil)
|
154
|
-
|
153
|
+
def create_changeset(comment = nil, tags = {})
|
154
|
+
tags.merge!(:comment => comment) { |key, v1, v2| v1 }
|
155
|
+
changeset = Changeset.new(:tags => tags)
|
155
156
|
changeset_id = put("/changeset/create", :body => changeset.to_xml).to_i
|
156
157
|
find_changeset(changeset_id) unless changeset_id == 0
|
157
158
|
end
|
data/lib/rosemary/version.rb
CHANGED
@@ -78,13 +78,13 @@ describe Changeset do
|
|
78
78
|
stubbed_request.to_return(:status => 200, :body => single_changeset, :headers => {'Content-Type' => 'application/xml'})
|
79
79
|
changeset = osm.find_changeset(10)
|
80
80
|
assert_requested :get, request_url, :times => 1
|
81
|
-
changeset.class.
|
81
|
+
expect(changeset.class).to eql Changeset
|
82
82
|
end
|
83
83
|
|
84
84
|
it "should raise an NotFound error, when a changeset cannot be found" do
|
85
85
|
stubbed_request.to_return(:status => 404, :body => '', :headers => {'Content-Type' => 'text/plain'})
|
86
86
|
node = osm.find_changeset(10)
|
87
|
-
node.
|
87
|
+
expect(node).to be_nil
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
@@ -102,30 +102,35 @@ describe Changeset do
|
|
102
102
|
body = Changeset.new(:tags => { :comment => 'New changeset' }).to_xml
|
103
103
|
|
104
104
|
stub_create_request.with(:body => body).to_return(:status => 200, :body => "3", :headers => {'Content-Type' => 'plain/text'})
|
105
|
-
auth_osm.
|
106
|
-
auth_osm.create_changeset('New changeset').
|
105
|
+
expect(auth_osm).to receive(:find_changeset).with(3).and_return(cs = double())
|
106
|
+
expect(auth_osm.create_changeset('New changeset')).to eql cs
|
107
107
|
end
|
108
108
|
end
|
109
109
|
|
110
110
|
describe "#find_or_create_open_changeset" do
|
111
111
|
it "returns an exisiting changeset if that exists and is open" do
|
112
|
-
auth_osm.
|
113
|
-
auth_osm.
|
114
|
-
auth_osm.find_or_create_open_changeset(3, "some foo comment").
|
112
|
+
expect(auth_osm).to receive(:find_changeset).with(3).and_return(cs = double(:open? => true))
|
113
|
+
expect(auth_osm).not_to receive(:create_changeset)
|
114
|
+
expect(auth_osm.find_or_create_open_changeset(3, "some foo comment")).to eql cs
|
115
115
|
end
|
116
116
|
|
117
117
|
it "returns an new changeset if the requested one exists and is closed" do
|
118
|
-
auth_osm.
|
119
|
-
auth_osm.
|
120
|
-
auth_osm.find_or_create_open_changeset(3, "some foo comment").
|
118
|
+
expect(auth_osm).to receive(:find_changeset).with(3).and_return(double(:open? => false))
|
119
|
+
expect(auth_osm).to receive(:create_changeset).with("some foo comment", {}).and_return(cs = double())
|
120
|
+
expect(auth_osm.find_or_create_open_changeset(3, "some foo comment")).to eql cs
|
121
121
|
end
|
122
122
|
|
123
123
|
it "returns an new changeset if the requested one doesn't exist" do
|
124
|
-
auth_osm.
|
125
|
-
auth_osm.
|
126
|
-
auth_osm.find_or_create_open_changeset(3, "some foo comment").
|
124
|
+
expect(auth_osm).to receive(:find_changeset).with(3).and_return(nil)
|
125
|
+
expect(auth_osm).to receive(:create_changeset).with("some foo comment", {}).and_return(cs = double())
|
126
|
+
expect(auth_osm.find_or_create_open_changeset(3, "some foo comment")).to eql cs
|
127
127
|
end
|
128
128
|
|
129
|
+
it "appends arbitrary tags to the changeset itself" do
|
130
|
+
expect(auth_osm).to receive(:find_changeset).with(3).and_return(nil)
|
131
|
+
expect(auth_osm).to receive(:create_changeset).with("some foo comment", :source => 'http://example.com' ).and_return(cs = double())
|
132
|
+
expect(auth_osm.find_or_create_open_changeset(3, "some foo comment", :source => 'http://example.com' )).to eql cs
|
133
|
+
end
|
129
134
|
end
|
130
135
|
|
131
136
|
describe '#find_for_user' do
|
@@ -145,21 +150,21 @@ describe Changeset do
|
|
145
150
|
it "should not find changeset for user if user has none" do
|
146
151
|
stubbed_request.to_return(:status => 200, :body => missing_changeset, :headers => {'Content-Type' => 'application/xml'})
|
147
152
|
changesets = auth_osm.find_changesets_for_user
|
148
|
-
changesets.
|
153
|
+
expect(changesets).to be_empty
|
149
154
|
end
|
150
155
|
|
151
156
|
it "should find a single changeset for user" do
|
152
157
|
stubbed_request.to_return(:status => 200, :body => single_changeset, :headers => {'Content-Type' => 'application/xml'})
|
153
158
|
changesets = auth_osm.find_changesets_for_user
|
154
|
-
changesets.size.
|
155
|
-
changesets.first.class.
|
159
|
+
expect(changesets.size).to eql 1
|
160
|
+
expect(changesets.first.class).to eql Changeset
|
156
161
|
end
|
157
162
|
|
158
163
|
it "should find a multiple changesets for a user" do
|
159
164
|
stubbed_request.to_return(:status => 200, :body => multiple_changeset, :headers => {'Content-Type' => 'application/xml'})
|
160
165
|
changesets = auth_osm.find_changesets_for_user
|
161
|
-
changesets.size.
|
162
|
-
changesets.first.class.
|
166
|
+
expect(changesets.size).to eql 2
|
167
|
+
expect(changesets.first.class).to eql Changeset
|
163
168
|
end
|
164
169
|
end
|
165
170
|
|
@@ -72,32 +72,32 @@ describe Node do
|
|
72
72
|
stubbed_request.to_return(:status => 200, :body => valid_fake_node, :headers => {'Content-Type' => 'application/xml'})
|
73
73
|
node = osm.find_node 1234
|
74
74
|
assert_requested :get, request_url, :times => 1
|
75
|
-
node.class.
|
76
|
-
node.tags.size.
|
77
|
-
node.tags['name'].
|
78
|
-
node['name'].
|
75
|
+
expect(node.class).to eql Node
|
76
|
+
expect(node.tags.size).to eql 3
|
77
|
+
expect(node.tags['name']).to eql 'The rose'
|
78
|
+
expect(node['name']).to eql 'The rose'
|
79
79
|
node.add_tags('wheelchair' => 'yes')
|
80
|
-
node['wheelchair'].
|
80
|
+
expect(node['wheelchair']).to eql 'yes'
|
81
81
|
end
|
82
82
|
|
83
83
|
it "should raise a Unavailable, when api times out" do
|
84
84
|
stubbed_request.to_timeout
|
85
|
-
|
85
|
+
expect {
|
86
86
|
node = osm.find_node(1234)
|
87
|
-
}.
|
87
|
+
}.to raise_exception(Unavailable)
|
88
88
|
end
|
89
89
|
|
90
90
|
it "should raise an Gone error, when a node has been deleted" do
|
91
91
|
stubbed_request.to_return(:status => 410, :body => '', :headers => {'Content-Type' => 'text/plain'})
|
92
|
-
|
92
|
+
expect {
|
93
93
|
node = osm.find_node(1234)
|
94
|
-
}.
|
94
|
+
}.to raise_exception(Gone)
|
95
95
|
end
|
96
96
|
|
97
97
|
it "should raise an NotFound error, when a node cannot be found" do
|
98
98
|
stubbed_request.to_return(:status => 404, :body => '', :headers => {'Content-Type' => 'text/plain'})
|
99
99
|
node = osm.find_node(1234)
|
100
|
-
node.
|
100
|
+
expect(node).to be_nil
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
@@ -142,37 +142,37 @@ describe Node do
|
|
142
142
|
|
143
143
|
it "should raise a Unavailable, when api times out" do
|
144
144
|
stubbed_request.to_timeout
|
145
|
-
|
145
|
+
expect {
|
146
146
|
new_id = osm.create(node, changeset)
|
147
|
-
}.
|
147
|
+
}.to raise_exception(Unavailable)
|
148
148
|
end
|
149
149
|
|
150
150
|
it "should not create a Node with invalid xml but raise BadRequest" do
|
151
151
|
stubbed_request.to_return(:status => 400, :body => 'The given node is invalid', :headers => {'Content-Type' => 'text/plain'})
|
152
|
-
|
152
|
+
expect {
|
153
153
|
new_id = osm.save(node, changeset)
|
154
|
-
}.
|
154
|
+
}.to raise_exception(BadRequest)
|
155
155
|
end
|
156
156
|
|
157
157
|
it "should not allow to create a node when a changeset has been closed" do
|
158
158
|
stubbed_request.to_return(:status => 409, :body => 'The given node is invalid', :headers => {'Content-Type' => 'text/plain'})
|
159
|
-
|
159
|
+
expect {
|
160
160
|
new_id = osm.save(node, changeset)
|
161
|
-
}.
|
161
|
+
}.to raise_exception(Conflict)
|
162
162
|
end
|
163
163
|
|
164
164
|
it "should not allow to create a node when no authentication client is given" do
|
165
165
|
osm = Api.new
|
166
|
-
|
166
|
+
expect {
|
167
167
|
osm.save(node, changeset)
|
168
|
-
}.
|
168
|
+
}.to raise_exception(CredentialsMissing)
|
169
169
|
end
|
170
170
|
|
171
171
|
it "should set a changeset" do
|
172
172
|
stubbed_request.to_return(:status => 200, :body => '123', :headers => {'Content-Type' => 'text/plain'})
|
173
173
|
node.changeset = nil
|
174
174
|
osm.save(node, changeset)
|
175
|
-
node.changeset.
|
175
|
+
expect(node.changeset).to eql changeset.id
|
176
176
|
end
|
177
177
|
end
|
178
178
|
|
@@ -191,16 +191,16 @@ describe Node do
|
|
191
191
|
stub_request(:put, "http://a_username:a_password@www.openstreetmap.org/api/0.6/node/123").to_return(:status => 200, :body => '43', :headers => {'Content-Type' => 'text/plain'})
|
192
192
|
node.tags['amenity'] = 'restaurant'
|
193
193
|
node.tags['name'] = 'Il Tramonto'
|
194
|
-
node.
|
194
|
+
expect(node).to receive(:changeset=)
|
195
195
|
new_version = osm.save(node, changeset)
|
196
|
-
new_version.
|
196
|
+
expect(new_version).to eql 43
|
197
197
|
end
|
198
198
|
|
199
199
|
it "should set a changeset" do
|
200
200
|
stub_request(:put, "http://a_username:a_password@www.openstreetmap.org/api/0.6/node/123").to_return(:status => 200, :body => '43', :headers => {'Content-Type' => 'text/plain'})
|
201
201
|
node.changeset = nil
|
202
202
|
osm.save(node, changeset)
|
203
|
-
node.changeset.
|
203
|
+
expect(node.changeset).to eql changeset.id
|
204
204
|
end
|
205
205
|
|
206
206
|
|
@@ -225,56 +225,56 @@ describe Node do
|
|
225
225
|
|
226
226
|
it "should delete an existing node" do
|
227
227
|
stub_request(:delete, "http://a_username:a_password@www.openstreetmap.org/api/0.6/node/123").to_return(:status => 200, :body => '43', :headers => {'Content-Type' => 'text/plain'})
|
228
|
-
node.
|
228
|
+
expect(node).to receive(:changeset=)
|
229
229
|
new_version = osm.destroy(node, changeset)
|
230
|
-
new_version.
|
230
|
+
expect(new_version).to eql 43 # new version number
|
231
231
|
end
|
232
232
|
|
233
233
|
it "should raise an error if node to be deleted is still part of a way" do
|
234
234
|
stub_request(:delete, "http://a_username:a_password@www.openstreetmap.org/api/0.6/node/123").to_return(:status => 400, :body => 'Version does not match current database version', :headers => {'Content-Type' => 'text/plain'})
|
235
|
-
|
235
|
+
expect {
|
236
236
|
response = osm.destroy(node, changeset)
|
237
|
-
response.
|
238
|
-
}.
|
237
|
+
expect(response).to eql "Version does not match current database version"
|
238
|
+
}.to raise_exception BadRequest
|
239
239
|
end
|
240
240
|
|
241
241
|
it "should raise an error if node cannot be found" do
|
242
242
|
stub_request(:delete, "http://a_username:a_password@www.openstreetmap.org/api/0.6/node/123").to_return(:status => 404, :body => 'Node cannot be found', :headers => {'Content-Type' => 'text/plain'})
|
243
|
-
|
243
|
+
expect {
|
244
244
|
response = osm.destroy(node, changeset)
|
245
|
-
response.
|
246
|
-
}.
|
245
|
+
expect(response).to eql "Node cannot be found"
|
246
|
+
}.to raise_exception NotFound
|
247
247
|
end
|
248
248
|
|
249
249
|
it "should raise an error if there is a conflict" do
|
250
250
|
stub_request(:delete, "http://a_username:a_password@www.openstreetmap.org/api/0.6/node/123").to_return(:status => 409, :body => 'Node has been deleted in this changeset', :headers => {'Content-Type' => 'text/plain'})
|
251
|
-
|
251
|
+
expect {
|
252
252
|
response = osm.destroy(node, changeset)
|
253
|
-
response.
|
254
|
-
}.
|
253
|
+
expect(response).to eql "Node has been deleted in this changeset"
|
254
|
+
}.to raise_exception Conflict
|
255
255
|
end
|
256
256
|
|
257
257
|
it "should raise an error if the node is already delted" do
|
258
258
|
stub_request(:delete, "http://a_username:a_password@www.openstreetmap.org/api/0.6/node/123").to_return(:status => 410, :body => 'Node has been deleted', :headers => {'Content-Type' => 'text/plain'})
|
259
|
-
|
259
|
+
expect {
|
260
260
|
response = osm.destroy(node, changeset)
|
261
|
-
response.
|
262
|
-
}.
|
261
|
+
expect(response).to eql "Node has been deleted"
|
262
|
+
}.to raise_exception Gone
|
263
263
|
end
|
264
264
|
|
265
265
|
it "should raise an error if the node is part of a way" do
|
266
266
|
stub_request(:delete, "http://a_username:a_password@www.openstreetmap.org/api/0.6/node/123").to_return(:status => 412, :body => 'Node 123 is still used by way 456', :headers => {'Content-Type' => 'text/plain'})
|
267
|
-
|
267
|
+
expect {
|
268
268
|
response = osm.destroy(node, changeset)
|
269
|
-
response.
|
270
|
-
}.
|
269
|
+
expect(response).to eql "Node 123 is still used by way 456"
|
270
|
+
}.to raise_exception Precondition
|
271
271
|
end
|
272
272
|
|
273
273
|
it "should set the changeset an existing node" do
|
274
274
|
stub_request(:delete, "http://a_username:a_password@www.openstreetmap.org/api/0.6/node/123").to_return(:status => 200, :body => '43', :headers => {'Content-Type' => 'text/plain'})
|
275
275
|
node.changeset = nil
|
276
276
|
new_version = osm.destroy(node, changeset)
|
277
|
-
node.changeset.
|
277
|
+
expect(node.changeset).to eql changeset.id
|
278
278
|
end
|
279
279
|
end
|
280
280
|
end
|
@@ -324,37 +324,37 @@ describe Node do
|
|
324
324
|
|
325
325
|
it "should create a new Node from given attributes" do
|
326
326
|
stubbed_request.to_return(:status => 200, :body => '123', :headers => {'Content-Type' => 'text/plain'})
|
327
|
-
node.id.
|
327
|
+
expect(node.id).to be_nil
|
328
328
|
new_id = osm.save(node, changeset)
|
329
329
|
end
|
330
330
|
|
331
331
|
it "should raise a Unavailable, when api times out" do
|
332
332
|
stubbed_request.to_timeout
|
333
|
-
|
333
|
+
expect {
|
334
334
|
new_id = osm.save(node, changeset)
|
335
|
-
}.
|
335
|
+
}.to raise_exception(Unavailable)
|
336
336
|
end
|
337
337
|
|
338
338
|
|
339
339
|
it "should not create a Node with invalid xml but raise BadRequest" do
|
340
340
|
stubbed_request.to_return(:status => 400, :body => 'The given node is invalid', :headers => {'Content-Type' => 'text/plain'})
|
341
|
-
|
341
|
+
expect {
|
342
342
|
new_id = osm.save(node, changeset)
|
343
|
-
}.
|
343
|
+
}.to raise_exception(BadRequest)
|
344
344
|
end
|
345
345
|
|
346
346
|
it "should not allow to create a node when a changeset has been closed" do
|
347
347
|
stubbed_request.to_return(:status => 409, :body => 'The given node is invalid', :headers => {'Content-Type' => 'text/plain'})
|
348
|
-
|
348
|
+
expect {
|
349
349
|
new_id = osm.save(node, changeset)
|
350
|
-
}.
|
350
|
+
}.to raise_exception(Conflict)
|
351
351
|
end
|
352
352
|
|
353
353
|
it "should not allow to create a node when no authentication client is given" do
|
354
354
|
osm = Api.new
|
355
|
-
|
355
|
+
expect {
|
356
356
|
osm.save(node, changeset)
|
357
|
-
}.
|
357
|
+
}.to raise_exception(CredentialsMissing)
|
358
358
|
end
|
359
359
|
|
360
360
|
end
|
@@ -375,9 +375,9 @@ describe Node do
|
|
375
375
|
stub_request(:put, "http://www.openstreetmap.org/api/0.6/node/123").to_return(:status => 200, :body => '43', :headers => {'Content-Type' => 'text/plain'})
|
376
376
|
node.tags['amenity'] = 'restaurant'
|
377
377
|
node.tags['name'] = 'Il Tramonto'
|
378
|
-
node.
|
378
|
+
expect(node).to receive(:changeset=)
|
379
379
|
new_version = osm.save(node, changeset)
|
380
|
-
new_version.
|
380
|
+
expect(new_version).to eql 43
|
381
381
|
end
|
382
382
|
end
|
383
383
|
|
@@ -395,11 +395,11 @@ describe Node do
|
|
395
395
|
|
396
396
|
it "should delete an existing node" do
|
397
397
|
stub_request(:delete, "http://www.openstreetmap.org/api/0.6/node/123").to_return(:status => 200, :body => '43', :headers => {'Content-Type' => 'text/plain'})
|
398
|
-
node.
|
399
|
-
|
398
|
+
expect(node).to receive(:changeset=)
|
399
|
+
expect {
|
400
400
|
# Delete is not implemented using oauth
|
401
401
|
new_version = osm.destroy(node, changeset)
|
402
|
-
}.
|
402
|
+
}.to raise_exception(NotImplemented)
|
403
403
|
end
|
404
404
|
end
|
405
405
|
end
|
@@ -59,12 +59,12 @@ describe Note do
|
|
59
59
|
to_return(:status => 200, :body => valid_fake_note, :headers => {'Content-Type' => 'application/xml'})
|
60
60
|
|
61
61
|
new_note = osm.create_note(valid_note)
|
62
|
-
new_note.id.
|
63
|
-
new_note.lon.
|
64
|
-
new_note.lat.
|
65
|
-
new_note.text.
|
66
|
-
new_note.user.
|
67
|
-
new_note.action.
|
62
|
+
expect(new_note.id).to eql '174576'
|
63
|
+
expect(new_note.lon).to eql '102.2205'
|
64
|
+
expect(new_note.lat).to eql '2.1059'
|
65
|
+
expect(new_note.text).to eql 'Test note'
|
66
|
+
expect(new_note.user).to eql 'osmthis'
|
67
|
+
expect(new_note.action).to eql 'opened'
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
@@ -47,14 +47,14 @@ describe User do
|
|
47
47
|
it "should build a User from API response via find_user" do
|
48
48
|
stub_request(:get, "http://www.openstreetmap.org/api/0.6/user/details").to_return(:status => 200, :body => valid_fake_user, :headers => {'Content-Type' => 'application/xml'})
|
49
49
|
user = osm.find_user
|
50
|
-
user.class.
|
50
|
+
expect(user.class).to eql User
|
51
51
|
end
|
52
52
|
|
53
53
|
it "should raise error from api" do
|
54
54
|
stub_request(:get, "http://www.openstreetmap.org/api/0.6/user/details").to_return(:status => 403, :body => "OAuth token doesn't have that capability.", :headers => {'Content-Type' => 'plain/text'})
|
55
|
-
|
55
|
+
expect {
|
56
56
|
osm.find_user
|
57
|
-
}.
|
57
|
+
}.to raise_exception Forbidden
|
58
58
|
end
|
59
59
|
end
|
60
60
|
end
|
@@ -36,8 +36,8 @@ describe Way do
|
|
36
36
|
it "should build a Way from API response via get_way" do
|
37
37
|
stub_request(:get, "http://www.openstreetmap.org/api/0.6/way/1234").to_return(:status => 200, :body => valid_fake_way, :headers => {'Content-Type' => 'application/xml'})
|
38
38
|
way = osm.find_way(1234)
|
39
|
-
way.class.
|
40
|
-
way.nodes.
|
39
|
+
expect(way.class).to eql Way
|
40
|
+
expect(way.nodes).to include(15735246)
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -20,43 +20,43 @@ describe Changeset do
|
|
20
20
|
subject { changeset }
|
21
21
|
|
22
22
|
it "should have an id attribute set from attributes" do
|
23
|
-
subject.id.
|
23
|
+
expect(subject.id).to eql(123)
|
24
24
|
end
|
25
25
|
|
26
26
|
it "should have a user attributes set from attributes" do
|
27
|
-
subject.user.
|
27
|
+
expect(subject.user).to eql("fred")
|
28
28
|
end
|
29
29
|
|
30
30
|
it "should have an uid attribute set from attributes" do
|
31
|
-
subject.uid.
|
31
|
+
expect(subject.uid).to eql(123)
|
32
32
|
end
|
33
33
|
|
34
34
|
it "should have a changeset attributes set from attributes" do
|
35
|
-
subject.
|
35
|
+
expect(subject).to be_open
|
36
36
|
end
|
37
37
|
|
38
38
|
it "should have a min_lat attribute set from attributes" do
|
39
|
-
subject.min_lat.
|
39
|
+
expect(subject.min_lat).to eql(52.2)
|
40
40
|
end
|
41
41
|
|
42
42
|
it "should have a min_lon attribute set from attributes" do
|
43
|
-
subject.min_lon.
|
43
|
+
expect(subject.min_lon).to eql(13.4)
|
44
44
|
end
|
45
45
|
|
46
46
|
it "should have a max_lat attribute set from attributes" do
|
47
|
-
subject.max_lat.
|
47
|
+
expect(subject.max_lat).to eql(52.3)
|
48
48
|
end
|
49
49
|
|
50
50
|
it "should have a max_lon attribute set from attributes" do
|
51
|
-
subject.max_lon.
|
51
|
+
expect(subject.max_lon).to eql(13.5)
|
52
52
|
end
|
53
53
|
|
54
54
|
it "should have a created_at attribute set from attributes" do
|
55
|
-
subject.created_at.
|
55
|
+
expect(subject.created_at).to eql Time.parse('2008-11-08T19:07:39+01:00')
|
56
56
|
end
|
57
57
|
|
58
58
|
it "should have a comment attribute set from attributes" do
|
59
|
-
subject.tags['comment'].
|
59
|
+
expect(subject.tags['comment']).to eql 'A bloody comment'
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
@@ -65,43 +65,43 @@ describe Changeset do
|
|
65
65
|
subject { changeset.to_xml }
|
66
66
|
|
67
67
|
it "should have an id attribute within xml representation" do
|
68
|
-
subject.
|
68
|
+
expect(subject).to have_xml "//changeset[@id='123']"
|
69
69
|
end
|
70
70
|
|
71
71
|
it "should have a user attribute within xml representation" do
|
72
|
-
subject.
|
72
|
+
expect(subject).to have_xml "//changeset[@user='fred']"
|
73
73
|
end
|
74
74
|
|
75
75
|
it "should have an uid attribute within xml representation" do
|
76
|
-
subject.
|
76
|
+
expect(subject).to have_xml "//changeset[@uid='123']"
|
77
77
|
end
|
78
78
|
|
79
79
|
it "should have an open attribute within xml representation" do
|
80
|
-
subject.
|
80
|
+
expect(subject).to have_xml "//changeset[@open='true']"
|
81
81
|
end
|
82
82
|
|
83
83
|
it "should have a min_lat attribute within xml representation" do
|
84
|
-
subject.
|
84
|
+
expect(subject).to have_xml "//changeset[@min_lat='52.2']"
|
85
85
|
end
|
86
86
|
|
87
87
|
it "should have a min_lon attribute within xml representation" do
|
88
|
-
subject.
|
88
|
+
expect(subject).to have_xml "//changeset[@min_lon='13.4']"
|
89
89
|
end
|
90
90
|
|
91
91
|
it "should have a max_lat attribute within xml representation" do
|
92
|
-
subject.
|
92
|
+
expect(subject).to have_xml "//changeset[@max_lat='52.3']"
|
93
93
|
end
|
94
94
|
|
95
95
|
it "should have a max_lon attribute within xml representation" do
|
96
|
-
subject.
|
96
|
+
expect(subject).to have_xml "//changeset[@max_lon='13.5']"
|
97
97
|
end
|
98
98
|
|
99
99
|
it "should have a created_at attribute within xml representation" do
|
100
|
-
subject.
|
100
|
+
expect(subject).to have_xml "//changeset[@created_at=\'#{Time.parse('2008-11-08T19:07:39+01:00')}\']"
|
101
101
|
end
|
102
102
|
|
103
103
|
it "should have a comment tag within xml representation" do
|
104
|
-
subject.
|
104
|
+
expect(subject).to have_xml "//tag[@k='comment'][@v='A bloody comment']"
|
105
105
|
end
|
106
106
|
|
107
107
|
end
|
data/spec/models/node_spec.rb
CHANGED
@@ -19,99 +19,99 @@ describe Node do
|
|
19
19
|
it "should be invalid without lat, lon" do
|
20
20
|
subject.lat = nil
|
21
21
|
subject.lon = nil
|
22
|
-
subject.
|
22
|
+
expect(subject).not_to be_valid
|
23
23
|
end
|
24
24
|
|
25
25
|
it "does not modify the hash passed into constructor" do
|
26
26
|
h = { :lat => 13.9, :lon => 54.1 }.freeze
|
27
|
-
|
27
|
+
expect { Node.new(h) }.not_to raise_exception
|
28
28
|
end
|
29
29
|
|
30
30
|
it "should not be valid when using to large lat value" do
|
31
31
|
subject.lat = 181
|
32
|
-
subject.
|
32
|
+
expect(subject).not_to be_valid
|
33
33
|
end
|
34
34
|
|
35
35
|
it "should not be valid when using to large lat value" do
|
36
36
|
subject.lon = 91
|
37
|
-
subject.
|
37
|
+
expect(subject).not_to be_valid
|
38
38
|
end
|
39
39
|
|
40
40
|
it "should have an id attribute set from attributes" do
|
41
|
-
subject.id.
|
41
|
+
expect(subject.id).to eql(123)
|
42
42
|
end
|
43
43
|
|
44
44
|
it "should have an id attribute within xml representation" do
|
45
|
-
subject.to_xml.
|
45
|
+
expect(subject.to_xml).to match /id=\"123\"/
|
46
46
|
end
|
47
47
|
|
48
48
|
it "should have a lat attribute set from attributes" do
|
49
|
-
subject.lat.
|
49
|
+
expect(subject.lat).to eql(52.2)
|
50
50
|
end
|
51
51
|
|
52
52
|
it "should have a lat attribute within xml representation" do
|
53
|
-
subject.to_xml.
|
53
|
+
expect(subject.to_xml).to match /lat=\"52.2\"/
|
54
54
|
end
|
55
55
|
|
56
56
|
it "should have a lon attribute set from attributes" do
|
57
|
-
subject.lon.
|
57
|
+
expect(subject.lon).to eql(13.4)
|
58
58
|
end
|
59
59
|
|
60
60
|
it "should have a lon attribute within xml representation" do
|
61
|
-
subject.to_xml.
|
61
|
+
expect(subject.to_xml).to match /lon=\"13.4\"/
|
62
62
|
end
|
63
63
|
|
64
64
|
it "should have a user attributes set from attributes" do
|
65
|
-
subject.user.
|
65
|
+
expect(subject.user).to eql("fred")
|
66
66
|
end
|
67
67
|
|
68
68
|
it "should have a user attribute within xml representation" do
|
69
|
-
subject.to_xml.
|
69
|
+
expect(subject.to_xml).to match /user=\"fred\"/
|
70
70
|
end
|
71
71
|
|
72
72
|
it "should have a changeset attributes set from attributes" do
|
73
|
-
subject.changeset.
|
73
|
+
expect(subject.changeset).to eql(12)
|
74
74
|
end
|
75
75
|
|
76
76
|
it "should have a changeset attribute within xml representation" do
|
77
|
-
subject.to_xml.
|
77
|
+
expect(subject.to_xml).to match /changeset=\"12\"/
|
78
78
|
end
|
79
79
|
|
80
80
|
it "should have a uid attribute set from attributes" do
|
81
|
-
subject.uid.
|
81
|
+
expect(subject.uid).to eql(123)
|
82
82
|
end
|
83
83
|
|
84
84
|
it "should have a uid attribute within xml representation" do
|
85
|
-
subject.to_xml.
|
85
|
+
expect(subject.to_xml).to match /uid=\"123\"/
|
86
86
|
end
|
87
87
|
|
88
88
|
it "should have a version attribute for osm tag" do
|
89
|
-
subject.to_xml.
|
89
|
+
expect(subject.to_xml).to match /version=\"0.6\"/
|
90
90
|
end
|
91
91
|
|
92
92
|
it "should have a generator attribute for osm tag" do
|
93
|
-
subject.to_xml.
|
93
|
+
expect(subject.to_xml).to match /generator=\"rosemary v/
|
94
94
|
end
|
95
95
|
|
96
96
|
it "should produce xml" do
|
97
97
|
subject.add_tags(:wheelchair => 'yes')
|
98
|
-
subject.to_xml.
|
99
|
-
subject.to_xml.
|
98
|
+
expect(subject.to_xml).to match /k=\"wheelchair\"/
|
99
|
+
expect(subject.to_xml).to match /v=\"yes\"/
|
100
100
|
end
|
101
101
|
|
102
102
|
it "should not add tags with empty value to xml" do
|
103
103
|
subject.add_tags(:wheelchair => '')
|
104
|
-
subject.to_xml.
|
104
|
+
expect(subject.to_xml).not_to match /k=\"wheelchair\"/
|
105
105
|
end
|
106
106
|
|
107
107
|
it "should properly escape ampersands" do
|
108
108
|
subject.name = "foo & bar"
|
109
|
-
subject.to_xml.
|
109
|
+
expect(subject.to_xml).to match "foo & bar"
|
110
110
|
end
|
111
111
|
|
112
112
|
it "should properly strip leading and trailing whitespace" do
|
113
113
|
subject.name = " Allice and Bob "
|
114
|
-
subject.to_xml.
|
114
|
+
expect(subject.to_xml).to match "\"Allice and Bob\""
|
115
115
|
end
|
116
116
|
|
117
117
|
it "should compare identity depending on tags and attributes" do
|
@@ -119,43 +119,43 @@ describe Node do
|
|
119
119
|
first_node.tags[:name] = 'Black horse'
|
120
120
|
second_node = Node.new('id' => 123, 'changeset' => '123', 'version' => 1, 'user' => 'horst', 'uid' => '123', 'timestamp' => '2005-07-30T14:27:12+01:00')
|
121
121
|
second_node.tags[:name] = 'Black horse'
|
122
|
-
(first_node <=> second_node).
|
122
|
+
expect(first_node <=> second_node).to eql 0
|
123
123
|
end
|
124
124
|
|
125
125
|
it "should not be equal when id does not match" do
|
126
126
|
first_node = Node.new('id' => 123)
|
127
127
|
second_node = Node.new('id' => 234)
|
128
|
-
first_node.
|
128
|
+
expect(first_node).not_to eql second_node
|
129
129
|
end
|
130
130
|
|
131
131
|
it "should not be equal when changeset does not match" do
|
132
132
|
first_node = Node.new('changeset' => 123)
|
133
133
|
second_node = Node.new('changeset' => 234)
|
134
|
-
first_node.
|
134
|
+
expect(first_node).not_to eql second_node
|
135
135
|
end
|
136
136
|
|
137
137
|
it "should not be equal when version does not match" do
|
138
138
|
first_node = Node.new('version' => 1)
|
139
139
|
second_node = Node.new('version' => 2)
|
140
|
-
first_node.
|
140
|
+
expect(first_node).not_to eql second_node
|
141
141
|
end
|
142
142
|
|
143
143
|
it "should not be equal when user does not match" do
|
144
144
|
first_node = Node.new('user' => 'horst')
|
145
145
|
second_node = Node.new('user' => 'jack')
|
146
|
-
first_node.
|
146
|
+
expect(first_node).not_to eql second_node
|
147
147
|
end
|
148
148
|
|
149
149
|
it "should not be equal when uid does not match" do
|
150
150
|
first_node = Node.new('uid' => 123)
|
151
151
|
second_node = Node.new('uid' => 234)
|
152
|
-
first_node.
|
152
|
+
expect(first_node).not_to eql second_node
|
153
153
|
end
|
154
154
|
|
155
155
|
it "should not be equal when timestamp does not match" do
|
156
156
|
first_node = Node.new('timestamp' => '2005-07-30T14:27:12+01:00')
|
157
157
|
second_node = Node.new('timestamp' => '2006-07-30T14:27:12+01:00')
|
158
|
-
first_node.
|
158
|
+
expect(first_node).not_to eql second_node
|
159
159
|
end
|
160
160
|
|
161
161
|
it "should not be equal when tags do not match" do
|
@@ -163,15 +163,15 @@ describe Node do
|
|
163
163
|
first_node.tags[:name] = 'black horse'
|
164
164
|
second_node = Node.new('id' => 123)
|
165
165
|
second_node.tags[:name] = 'white horse'
|
166
|
-
first_node.
|
166
|
+
expect(first_node).not_to eql second_node
|
167
167
|
end
|
168
168
|
|
169
169
|
it "should be ok to pass tags with emtpy value" do
|
170
|
-
|
170
|
+
expect {
|
171
171
|
subject.add_tags({"wheelchair_description"=>"", "type"=>"convenience",
|
172
172
|
"street"=>nil, "name"=>"Kochhaus", "wheelchair"=>nil, "postcode"=>nil,
|
173
173
|
"phone"=>nil, "city"=>nil, "website"=>nil, "lon"=>"13.35598468780518",
|
174
174
|
"lat"=>"52.48627569798567", "housenumber"=>nil})
|
175
|
-
}.
|
175
|
+
}.not_to raise_exception
|
176
176
|
end
|
177
177
|
end
|
data/spec/models/parser_spec.rb
CHANGED
@@ -15,7 +15,7 @@ describe Parser do
|
|
15
15
|
EOF
|
16
16
|
|
17
17
|
n = Parser.call(node_xml, :xml)
|
18
|
-
n.name.
|
18
|
+
expect(n.name).to eql "The rose & the pony"
|
19
19
|
|
20
20
|
|
21
21
|
|
@@ -30,7 +30,7 @@ describe Parser do
|
|
30
30
|
EOF
|
31
31
|
|
32
32
|
permissions = Parser.call(permissions_xml, :xml)
|
33
|
-
permissions.raw.
|
33
|
+
expect(permissions.raw).to be_empty
|
34
34
|
end
|
35
35
|
|
36
36
|
it "parses permissions" do
|
@@ -44,11 +44,11 @@ describe Parser do
|
|
44
44
|
EOF
|
45
45
|
|
46
46
|
permissions = Parser.call(permissions_xml, :xml)
|
47
|
-
permissions.raw.sort.
|
47
|
+
expect(permissions.raw.sort).to eql %w(allow_read_prefs allow_write_api)
|
48
48
|
|
49
|
-
permissions.allow_write_api
|
50
|
-
permissions.allow_read_prefs
|
51
|
-
permissions.allow_write_prefs
|
49
|
+
expect(permissions.allow_write_api?).to eql true
|
50
|
+
expect(permissions.allow_read_prefs?).to eql true
|
51
|
+
expect(permissions.allow_write_prefs?).to eql false
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
@@ -20,7 +20,7 @@ describe Relation do
|
|
20
20
|
it { should be_valid }
|
21
21
|
|
22
22
|
it "should have members" do
|
23
|
-
subject.members.size.
|
23
|
+
expect(subject.members.size).to eql 2
|
24
24
|
end
|
25
25
|
|
26
26
|
it "should compare identity depending on tags and attributes" do
|
@@ -28,43 +28,43 @@ describe Relation do
|
|
28
28
|
first_relation.tags[:name] = 'Black horse'
|
29
29
|
second_relation = Relation.new('id' => 123, 'changeset' => '123', 'version' => 1, 'user' => 'horst', 'uid' => '123', 'timestamp' => '2005-07-30T14:27:12+01:00')
|
30
30
|
second_relation.tags[:name] = 'Black horse'
|
31
|
-
first_relation
|
31
|
+
expect(first_relation == second_relation).to eql true
|
32
32
|
end
|
33
33
|
|
34
34
|
it "should not be equal when id does not match" do
|
35
35
|
first_relation = Relation.new('id' => 123)
|
36
36
|
second_relation = Relation.new('id' => 234)
|
37
|
-
first_relation.
|
37
|
+
expect(first_relation).not_to eql second_relation
|
38
38
|
end
|
39
39
|
|
40
40
|
it "should not be equal when changeset does not match" do
|
41
41
|
first_relation = Relation.new('changeset' => 123)
|
42
42
|
second_relation = Relation.new('changeset' => 234)
|
43
|
-
first_relation.
|
43
|
+
expect(first_relation).not_to eql second_relation
|
44
44
|
end
|
45
45
|
|
46
46
|
it "should not be equal when version does not match" do
|
47
47
|
first_relation = Relation.new('version' => 1)
|
48
48
|
second_relation = Relation.new('version' => 2)
|
49
|
-
first_relation.
|
49
|
+
expect(first_relation).not_to eql second_relation
|
50
50
|
end
|
51
51
|
|
52
52
|
it "should not be equal when user does not match" do
|
53
53
|
first_relation = Relation.new('user' => 'horst')
|
54
54
|
second_relation = Relation.new('user' => 'jack')
|
55
|
-
first_relation.
|
55
|
+
expect(first_relation).not_to eql second_relation
|
56
56
|
end
|
57
57
|
|
58
58
|
it "should not be equal when uid does not match" do
|
59
59
|
first_relation = Relation.new('uid' => 123)
|
60
60
|
second_relation = Relation.new('uid' => 234)
|
61
|
-
first_relation.
|
61
|
+
expect(first_relation).not_to eql second_relation
|
62
62
|
end
|
63
63
|
|
64
64
|
it "should not be equal when timestamp does not match" do
|
65
65
|
first_relation = Relation.new('timestamp' => '2005-07-30T14:27:12+01:00')
|
66
66
|
second_relation = Relation.new('timestamp' => '2006-07-30T14:27:12+01:00')
|
67
|
-
first_relation.
|
67
|
+
expect(first_relation).not_to eql second_relation
|
68
68
|
end
|
69
69
|
|
70
70
|
it "should not be equal when members do not match" do
|
@@ -74,7 +74,7 @@ describe Relation do
|
|
74
74
|
second_relation = Relation.new('id' => 123)
|
75
75
|
second_relation.members << 1
|
76
76
|
second_relation.members << 3
|
77
|
-
first_relation.
|
77
|
+
expect(first_relation).not_to eql second_relation
|
78
78
|
end
|
79
79
|
|
80
80
|
it "should not be equal when tags do not match" do
|
@@ -82,7 +82,7 @@ describe Relation do
|
|
82
82
|
first_relation.tags[:name] = 'black horse'
|
83
83
|
second_relation = Relation.new('id' => 123)
|
84
84
|
second_relation.tags[:name] = 'white horse'
|
85
|
-
first_relation.
|
85
|
+
expect(first_relation).not_to eql second_relation
|
86
86
|
end
|
87
87
|
|
88
88
|
end
|
data/spec/models/way_spec.rb
CHANGED
@@ -27,65 +27,65 @@ describe Way do
|
|
27
27
|
@way ||= Way.from_xml(valid_fake_way)
|
28
28
|
end
|
29
29
|
|
30
|
-
it "should have
|
31
|
-
subject.nodes.size.
|
32
|
-
subject.nodes.first.
|
30
|
+
it "should have 11 nodes" do
|
31
|
+
expect(subject.nodes.size).to eql 11
|
32
|
+
expect(subject.nodes.first).to eql 15735248
|
33
33
|
end
|
34
34
|
|
35
35
|
it "should have node referenzes in xml representation" do
|
36
|
-
subject.to_xml.
|
36
|
+
expect(subject.to_xml).to match /ref=\"15735248\"/
|
37
37
|
end
|
38
38
|
|
39
39
|
|
40
40
|
it "should have an id attribute set from attributes" do
|
41
|
-
subject.id.
|
41
|
+
expect(subject.id).to eql(1234)
|
42
42
|
end
|
43
43
|
|
44
44
|
it "should have an id attribute within xml representation" do
|
45
|
-
subject.to_xml.
|
45
|
+
expect(subject.to_xml).to match /id=\"1234\"/
|
46
46
|
end
|
47
47
|
|
48
48
|
it "should have a user attributes set from attributes" do
|
49
|
-
subject.user.
|
49
|
+
expect(subject.user).to eql("fred")
|
50
50
|
end
|
51
51
|
|
52
52
|
it "should have a user attribute within xml representation" do
|
53
|
-
subject.to_xml.
|
53
|
+
expect(subject.to_xml).to match /user=\"fred\"/
|
54
54
|
end
|
55
55
|
|
56
56
|
it "should have a changeset attributes set from attributes" do
|
57
|
-
subject.changeset.
|
57
|
+
expect(subject.changeset).to eql(12)
|
58
58
|
end
|
59
59
|
|
60
60
|
it "should have a changeset attribute within xml representation" do
|
61
|
-
subject.to_xml.
|
61
|
+
expect(subject.to_xml).to match /changeset=\"12\"/
|
62
62
|
end
|
63
63
|
|
64
64
|
it "should have a uid attribute set from attributes" do
|
65
|
-
subject.uid.
|
65
|
+
expect(subject.uid).to eql(123)
|
66
66
|
end
|
67
67
|
|
68
68
|
it "should have a uid attribute within xml representation" do
|
69
|
-
subject.to_xml.
|
69
|
+
expect(subject.to_xml).to match /uid=\"123\"/
|
70
70
|
end
|
71
71
|
|
72
72
|
it "should have a version attribute for osm tag" do
|
73
|
-
subject.to_xml.
|
73
|
+
expect(subject.to_xml).to match /version=\"0.6\"/
|
74
74
|
end
|
75
75
|
|
76
76
|
it "should have a generator attribute for osm tag" do
|
77
|
-
subject.to_xml.
|
77
|
+
expect(subject.to_xml).to match /generator=\"rosemary v/
|
78
78
|
end
|
79
79
|
|
80
80
|
it "should produce xml" do
|
81
81
|
subject.add_tags(:wheelchair => 'yes')
|
82
|
-
subject.to_xml.
|
83
|
-
subject.to_xml.
|
82
|
+
expect(subject.to_xml).to match /k=\"wheelchair\"/
|
83
|
+
expect(subject.to_xml).to match /v=\"yes\"/
|
84
84
|
end
|
85
85
|
|
86
86
|
it "should not add tags with empty value to xml" do
|
87
87
|
subject.add_tags(:wheelchair => '')
|
88
|
-
subject.to_xml.
|
88
|
+
expect(subject.to_xml).not_to match /k=\"wheelchair\"/
|
89
89
|
end
|
90
90
|
|
91
91
|
it "should compare identity depending on tags and attributes" do
|
@@ -93,43 +93,43 @@ describe Way do
|
|
93
93
|
first_way.tags[:name] = 'Black horse'
|
94
94
|
second_way = Way.new('id' => 123, 'changeset' => '123', 'version' => 1, 'user' => 'horst', 'uid' => '123', 'timestamp' => '2005-07-30T14:27:12+01:00')
|
95
95
|
second_way.tags[:name] = 'Black horse'
|
96
|
-
first_way
|
96
|
+
expect(first_way == second_way).to eql true
|
97
97
|
end
|
98
98
|
|
99
99
|
it "should not be equal when id does not match" do
|
100
100
|
first_way = Way.new('id' => 123)
|
101
101
|
second_way = Way.new('id' => 234)
|
102
|
-
first_way
|
102
|
+
expect(first_way == second_way).not_to eql true
|
103
103
|
end
|
104
104
|
|
105
105
|
it "should not be equal when changeset does not match" do
|
106
106
|
first_way = Way.new('changeset' => 123)
|
107
107
|
second_way = Way.new('changeset' => 234)
|
108
|
-
first_way
|
108
|
+
expect(first_way == second_way).not_to eql true
|
109
109
|
end
|
110
110
|
|
111
111
|
it "should not be equal when version does not match" do
|
112
112
|
first_way = Way.new('version' => 1)
|
113
113
|
second_way = Way.new('version' => 2)
|
114
|
-
first_way
|
114
|
+
expect(first_way == second_way).not_to eql true
|
115
115
|
end
|
116
116
|
|
117
117
|
it "should not be equal when user does not match" do
|
118
118
|
first_way = Way.new('user' => 'horst')
|
119
119
|
second_way = Way.new('user' => 'jack')
|
120
|
-
first_way
|
120
|
+
expect(first_way == second_way).not_to eql true
|
121
121
|
end
|
122
122
|
|
123
123
|
it "should not be equal when uid does not match" do
|
124
124
|
first_way = Way.new('uid' => 123)
|
125
125
|
second_way = Way.new('uid' => 234)
|
126
|
-
first_way
|
126
|
+
expect(first_way == second_way).not_to eql true
|
127
127
|
end
|
128
128
|
|
129
129
|
it "should not be equal when timestamp does not match" do
|
130
130
|
first_way = Way.new('timestamp' => '2005-07-30T14:27:12+01:00')
|
131
131
|
second_way = Way.new('timestamp' => '2006-07-30T14:27:12+01:00')
|
132
|
-
first_way
|
132
|
+
expect(first_way == second_way).not_to eql true
|
133
133
|
end
|
134
134
|
|
135
135
|
it "should not be equal when nodes do not match" do
|
@@ -139,7 +139,7 @@ describe Way do
|
|
139
139
|
second_way = Way.new('id' => 123)
|
140
140
|
second_way.nodes << 1
|
141
141
|
second_way.nodes << 3
|
142
|
-
first_way
|
142
|
+
expect(first_way == second_way).not_to eql true
|
143
143
|
end
|
144
144
|
|
145
145
|
it "should not be equal when tags do not match" do
|
@@ -147,6 +147,6 @@ describe Way do
|
|
147
147
|
first_way.tags[:name] = 'black horse'
|
148
148
|
second_way = Way.new('id' => 123)
|
149
149
|
second_way.tags[:name] = 'white horse'
|
150
|
-
first_way
|
150
|
+
expect(first_way == second_way).not_to eql true
|
151
151
|
end
|
152
152
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -9,7 +9,7 @@ RSpec::Matchers.define :have_xml do |xpath, text|
|
|
9
9
|
parser = LibXML::XML::Parser.string body
|
10
10
|
doc = parser.parse
|
11
11
|
nodes = doc.find(xpath)
|
12
|
-
nodes.
|
12
|
+
expect(nodes).not_to be_empty
|
13
13
|
if text
|
14
14
|
nodes.each do |node|
|
15
15
|
node.content.should == text
|
@@ -18,11 +18,11 @@ RSpec::Matchers.define :have_xml do |xpath, text|
|
|
18
18
|
true
|
19
19
|
end
|
20
20
|
|
21
|
-
|
21
|
+
failure_message do |body|
|
22
22
|
"expected to find xml tag #{xpath} in:\n#{body}"
|
23
23
|
end
|
24
24
|
|
25
|
-
|
25
|
+
failure_message_when_negated do |response|
|
26
26
|
"expected not to find xml tag #{xpath} in:\n#{body}"
|
27
27
|
end
|
28
28
|
|
metadata
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rosemary
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Christoph Bünte, Enno Brehm
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2014-
|
12
|
+
date: 2014-08-07 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: httparty
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
19
|
- - ~>
|
18
20
|
- !ruby/object:Gem::Version
|
@@ -20,6 +22,7 @@ dependencies:
|
|
20
22
|
type: :runtime
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
27
|
- - ~>
|
25
28
|
- !ruby/object:Gem::Version
|
@@ -27,6 +30,7 @@ dependencies:
|
|
27
30
|
- !ruby/object:Gem::Dependency
|
28
31
|
name: libxml-ruby
|
29
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
30
34
|
requirements:
|
31
35
|
- - ! '>='
|
32
36
|
- !ruby/object:Gem::Version
|
@@ -34,6 +38,7 @@ dependencies:
|
|
34
38
|
type: :runtime
|
35
39
|
prerelease: false
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
37
42
|
requirements:
|
38
43
|
- - ! '>='
|
39
44
|
- !ruby/object:Gem::Version
|
@@ -41,6 +46,7 @@ dependencies:
|
|
41
46
|
- !ruby/object:Gem::Dependency
|
42
47
|
name: builder
|
43
48
|
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
44
50
|
requirements:
|
45
51
|
- - ! '>='
|
46
52
|
- !ruby/object:Gem::Version
|
@@ -48,6 +54,7 @@ dependencies:
|
|
48
54
|
type: :runtime
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
51
58
|
requirements:
|
52
59
|
- - ! '>='
|
53
60
|
- !ruby/object:Gem::Version
|
@@ -55,6 +62,7 @@ dependencies:
|
|
55
62
|
- !ruby/object:Gem::Dependency
|
56
63
|
name: oauth
|
57
64
|
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
58
66
|
requirements:
|
59
67
|
- - ! '>='
|
60
68
|
- !ruby/object:Gem::Version
|
@@ -62,6 +70,7 @@ dependencies:
|
|
62
70
|
type: :runtime
|
63
71
|
prerelease: false
|
64
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
65
74
|
requirements:
|
66
75
|
- - ! '>='
|
67
76
|
- !ruby/object:Gem::Version
|
@@ -69,6 +78,7 @@ dependencies:
|
|
69
78
|
- !ruby/object:Gem::Dependency
|
70
79
|
name: activemodel
|
71
80
|
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
72
82
|
requirements:
|
73
83
|
- - ! '>='
|
74
84
|
- !ruby/object:Gem::Version
|
@@ -76,6 +86,7 @@ dependencies:
|
|
76
86
|
type: :runtime
|
77
87
|
prerelease: false
|
78
88
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
79
90
|
requirements:
|
80
91
|
- - ! '>='
|
81
92
|
- !ruby/object:Gem::Version
|
@@ -83,6 +94,7 @@ dependencies:
|
|
83
94
|
- !ruby/object:Gem::Dependency
|
84
95
|
name: rspec
|
85
96
|
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
86
98
|
requirements:
|
87
99
|
- - ! '>='
|
88
100
|
- !ruby/object:Gem::Version
|
@@ -90,6 +102,7 @@ dependencies:
|
|
90
102
|
type: :development
|
91
103
|
prerelease: false
|
92
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
93
106
|
requirements:
|
94
107
|
- - ! '>='
|
95
108
|
- !ruby/object:Gem::Version
|
@@ -97,6 +110,7 @@ dependencies:
|
|
97
110
|
- !ruby/object:Gem::Dependency
|
98
111
|
name: webmock
|
99
112
|
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
100
114
|
requirements:
|
101
115
|
- - ! '>='
|
102
116
|
- !ruby/object:Gem::Version
|
@@ -104,6 +118,7 @@ dependencies:
|
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
107
122
|
requirements:
|
108
123
|
- - ! '>='
|
109
124
|
- !ruby/object:Gem::Version
|
@@ -111,6 +126,7 @@ dependencies:
|
|
111
126
|
- !ruby/object:Gem::Dependency
|
112
127
|
name: rake
|
113
128
|
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
114
130
|
requirements:
|
115
131
|
- - ! '>='
|
116
132
|
- !ruby/object:Gem::Version
|
@@ -118,6 +134,7 @@ dependencies:
|
|
118
134
|
type: :development
|
119
135
|
prerelease: false
|
120
136
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
121
138
|
requirements:
|
122
139
|
- - ! '>='
|
123
140
|
- !ruby/object:Gem::Version
|
@@ -125,6 +142,7 @@ dependencies:
|
|
125
142
|
- !ruby/object:Gem::Dependency
|
126
143
|
name: yard
|
127
144
|
requirement: !ruby/object:Gem::Requirement
|
145
|
+
none: false
|
128
146
|
requirements:
|
129
147
|
- - ! '>='
|
130
148
|
- !ruby/object:Gem::Version
|
@@ -132,6 +150,7 @@ dependencies:
|
|
132
150
|
type: :development
|
133
151
|
prerelease: false
|
134
152
|
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
135
154
|
requirements:
|
136
155
|
- - ! '>='
|
137
156
|
- !ruby/object:Gem::Version
|
@@ -139,6 +158,7 @@ dependencies:
|
|
139
158
|
- !ruby/object:Gem::Dependency
|
140
159
|
name: redcarpet
|
141
160
|
requirement: !ruby/object:Gem::Requirement
|
161
|
+
none: false
|
142
162
|
requirements:
|
143
163
|
- - ! '>='
|
144
164
|
- !ruby/object:Gem::Version
|
@@ -146,6 +166,7 @@ dependencies:
|
|
146
166
|
type: :development
|
147
167
|
prerelease: false
|
148
168
|
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
149
170
|
requirements:
|
150
171
|
- - ! '>='
|
151
172
|
- !ruby/object:Gem::Version
|
@@ -153,6 +174,7 @@ dependencies:
|
|
153
174
|
- !ruby/object:Gem::Dependency
|
154
175
|
name: coveralls
|
155
176
|
requirement: !ruby/object:Gem::Requirement
|
177
|
+
none: false
|
156
178
|
requirements:
|
157
179
|
- - ! '>='
|
158
180
|
- !ruby/object:Gem::Version
|
@@ -160,6 +182,7 @@ dependencies:
|
|
160
182
|
type: :development
|
161
183
|
prerelease: false
|
162
184
|
version_requirements: !ruby/object:Gem::Requirement
|
185
|
+
none: false
|
163
186
|
requirements:
|
164
187
|
- - ! '>='
|
165
188
|
- !ruby/object:Gem::Version
|
@@ -218,7 +241,6 @@ files:
|
|
218
241
|
- spec/spec_helper.rb
|
219
242
|
homepage: https://github.com/sozialhelden/rosemary
|
220
243
|
licenses: []
|
221
|
-
metadata: {}
|
222
244
|
post_install_message:
|
223
245
|
rdoc_options:
|
224
246
|
- --line-numbers
|
@@ -230,18 +252,23 @@ rdoc_options:
|
|
230
252
|
require_paths:
|
231
253
|
- lib
|
232
254
|
required_ruby_version: !ruby/object:Gem::Requirement
|
255
|
+
none: false
|
233
256
|
requirements:
|
234
257
|
- - ! '>='
|
235
258
|
- !ruby/object:Gem::Version
|
236
259
|
version: '0'
|
260
|
+
segments:
|
261
|
+
- 0
|
262
|
+
hash: -1969309869700129610
|
237
263
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
264
|
+
none: false
|
238
265
|
requirements:
|
239
266
|
- - ! '>='
|
240
267
|
- !ruby/object:Gem::Version
|
241
268
|
version: '1.2'
|
242
269
|
requirements: []
|
243
270
|
rubyforge_project: rosemary
|
244
|
-
rubygems_version:
|
271
|
+
rubygems_version: 1.8.23.2
|
245
272
|
signing_key:
|
246
273
|
specification_version: 3
|
247
274
|
summary: OpenStreetMap API client for ruby
|
checksums.yaml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
---
|
2
|
-
!binary "U0hBMQ==":
|
3
|
-
metadata.gz: !binary |-
|
4
|
-
NDI3NDY3ZWM5MTI0MTE3OTgzYTE2MWNlMWU2MTM1YWNiNjBiNDY3ZA==
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
ZWQyNmNlMWVmZTdjYmIyNDE0NmRhZmQ2ZGU5MjJhZDdhNDQwYTA2Yg==
|
7
|
-
!binary "U0hBNTEy":
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
OTkxZjI5NjY3NzhkZGM1ZTM5NzhlYjJmYzFjZDhjNzkwZDgyNWIzYTY5ZTA1
|
10
|
-
ZTVhMjNjNTU3ZjMwYWNiZjY2MjczNjhkMmUzYWY2YzdmYWUwNzU5OTA3MjY1
|
11
|
-
YTZkYzhkMTkwZjRjZmMzZjJlZjc5YWVmMjQ0YzM3ZTllZDBmMjE=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MzBkZTViYTBkNjVlNzdmNzQ1YTkyNDdiMjNlNTgxNzU0YzM5Y2Q4OTk2Nzk4
|
14
|
-
ZDgwMjA5OTUwZDI2ZmNlOTUxNmU3NzI4ZWM1Y2FhNzBhOTFlZGY3M2Q0OWVi
|
15
|
-
NjQ1Mjg4ZTVjZDdhNTliZTk0MDZiYzAwMjlmZTg3OGFjMTI5YzY=
|