end
assert_response :success, "Expected scucess with the map call"
assert_select "osm[version='#{API_VERSION}'][generator='#{GENERATOR}']", :count => 1 do
- assert_select "bounds[minlon=#{minlon}][minlat=#{minlat}][maxlon=#{maxlon}][maxlat=#{maxlat}]", :count => 1
- assert_select "node[id=#{node.id}][lat=#{node.lat}][lon=#{node.lon}][version=#{node.version}][changeset=#{node.changeset_id}][visible=#{node.visible}][timestamp=#{node.timestamp.xmlschema}]", :count => 1 do
+ assert_select "bounds[minlon='#{minlon}'][minlat='#{minlat}'][maxlon='#{maxlon}'][maxlat='#{maxlat}']", :count => 1
+ assert_select "node[id='#{node.id}'][lat='#{node.lat}'][lon='#{node.lon}'][version='#{node.version}'][changeset='#{node.changeset_id}'][visible='#{node.visible}'][timestamp='#{node.timestamp.xmlschema}']", :count => 1 do
# This should really be more generic
assert_select "tag[k='test'][v='yes']"
end
get :map, :bbox => bbox
assert_response :success, "The map call should have succeeded"
assert_select "osm[version='#{API_VERSION}'][generator='#{GENERATOR}']", :count => 1 do
- assert_select "bounds[minlon=#{node.lon}][minlat=#{node.lat}][maxlon=#{node.lon}][maxlat=#{node.lat}]", :count => 1
- assert_select "node[id=#{node.id}][lat=#{node.lat}][lon=#{node.lon}][version=#{node.version}][changeset=#{node.changeset_id}][visible=#{node.visible}][timestamp=#{node.timestamp.xmlschema}]", :count => 1 do
+ assert_select "bounds[minlon='#{node.lon}'][minlat='#{node.lat}'][maxlon='#{node.lon}'][maxlat='#{node.lat}']", :count => 1
+ assert_select "node[id='#{node.id}'][lat='#{node.lat}'][lon='#{node.lon}'][version='#{node.version}'][changeset='#{node.changeset_id}'][visible='#{node.visible}'][timestamp='#{node.timestamp.xmlschema}']", :count => 1 do
# This should really be more generic
assert_select "tag[k='test'][v='yes']"
end
bbox = "#{minlon},#{minlat},#{maxlon},#{maxlat}"
get :trackpoints, :bbox => bbox
assert_response :success
- assert_select "gpx[version=1.0][creator=OpenStreetMap.org][xmlns=http://www.topografix.com/GPX/1/0]", :count => 1 do
+ assert_select "gpx[version='1.0'][creator='OpenStreetMap.org'][xmlns='http://www.topografix.com/GPX/1/0']", :count => 1 do
assert_select "trk" do
assert_select "trkseg"
end
bbox = "#{minlon},#{minlat},#{maxlon},#{maxlat}"
get :trackpoints, :bbox => bbox
assert_response :success
- assert_select "gpx[version=1.0][creator=OpenStreetMap.org][xmlns=http://www.topografix.com/GPX/1/0]", :count => 1 do
+ assert_select "gpx[version='1.0'][creator='OpenStreetMap.org'][xmlns='http://www.topografix.com/GPX/1/0']", :count => 1 do
assert_select "trk", :count => 1 do
assert_select "trk > trkseg", :count => 2 do |trksegs|
trksegs.each do |trkseg|
bbox = "#{minlon},#{minlat},#{maxlon},#{maxlat}"
get :trackpoints, :bbox => bbox
assert_response :success
- assert_select "gpx[version=1.0][creator=OpenStreetMap.org][xmlns=http://www.topografix.com/GPX/1/0]", :count => 1 do
+ assert_select "gpx[version='1.0'][creator='OpenStreetMap.org'][xmlns='http://www.topografix.com/GPX/1/0']", :count => 1 do
assert_select "trk", :count => 1 do
assert_select "trk>name", :count => 1
assert_select "trk>desc", :count => 1
assert_response :success
assert_select "osm[version='#{API_VERSION}'][generator='#{GENERATOR}']", :count => 1 do
assert_select "api", :count => 1 do
- assert_select "version[minimum=#{API_VERSION}][maximum=#{API_VERSION}]", :count => 1
- assert_select "area[maximum=#{MAX_REQUEST_AREA}]", :count => 1
- assert_select "tracepoints[per_page=#{TRACEPOINTS_PER_PAGE}]", :count => 1
- assert_select "changesets[maximum_elements=#{Changeset::MAX_ELEMENTS}]", :count => 1
- assert_select "status[database=online]", :count => 1
- assert_select "status[api=online]", :count => 1
- assert_select "status[gpx=online]", :count => 1
+ assert_select "version[minimum='#{API_VERSION}'][maximum='#{API_VERSION}']", :count => 1
+ assert_select "area[maximum='#{MAX_REQUEST_AREA}']", :count => 1
+ assert_select "tracepoints[per_page='#{TRACEPOINTS_PER_PAGE}']", :count => 1
+ assert_select "changesets[maximum_elements='#{Changeset::MAX_ELEMENTS}']", :count => 1
+ assert_select "status[database='online']", :count => 1
+ assert_select "status[api='online']", :count => 1
+ assert_select "status[gpx='online']", :count => 1
end
end
end
assert_select "osm > permissions", :count => 1 do
assert_select "permission", :count => ClientApplication.all_permissions.size
ClientApplication.all_permissions.each do |p|
- assert_select "permission[name=#{p}]", :count => 1
+ assert_select "permission[name='#{p}']", :count => 1
end
end
end
assert_response :success
assert_select "osm > permissions", :count => 1 do
assert_select "permission", :count => 2
- assert_select "permission[name=allow_read_prefs]", :count => 1
- assert_select "permission[name=allow_write_api]", :count => 1
- assert_select "permission[name=allow_read_gpx]", :count => 0
+ assert_select "permission[name='allow_read_prefs']", :count => 1
+ assert_select "permission[name='allow_write_api']", :count => 1
+ assert_select "permission[name='allow_read_gpx']", :count => 0
end
end
end
get :read, :id => changeset_id
assert_response :success, "cannot get first changeset"
- assert_select "osm[version=#{API_VERSION}][generator=\"OpenStreetMap server\"]", 1
- assert_select "osm>changeset[id=#{changeset_id}]", 1
+ assert_select "osm[version='#{API_VERSION}'][generator='OpenStreetMap server']", 1
+ assert_select "osm>changeset[id='#{changeset_id}']", 1
assert_select "osm>changeset>discussion", 0
get :read, :id => changeset_id, :include_discussion => true
assert_response :success, "cannot get first changeset with comments"
- assert_select "osm[version=#{API_VERSION}][generator=\"OpenStreetMap server\"]", 1
- assert_select "osm>changeset[id=#{changeset_id}]", 1
+ assert_select "osm[version='#{API_VERSION}'][generator='OpenStreetMap server']", 1
+ assert_select "osm>changeset[id='#{changeset_id}']", 1
assert_select "osm>changeset>discussion", 1
end
"can't do a conditional delete of in use objects: #{@response.body}"
# check the returned payload
- assert_select "diffResult[version=#{API_VERSION}][generator=\"OpenStreetMap server\"]", 1
+ assert_select "diffResult[version='#{API_VERSION}'][generator='OpenStreetMap server']", 1
assert_select "diffResult>node", 1
assert_select "diffresult>way", 1
assert_select "diffResult>relation", 1
"failed to return error in XML format"
# check the returned payload
- assert_select "osmError[version=#{API_VERSION}][generator=\"OpenStreetMap server\"]", 1
+ assert_select "osmError[version='#{API_VERSION}'][generator='OpenStreetMap server']", 1
assert_select "osmError>status", 1
assert_select "osmError>message", 1
# FIXME needs more assert_select tests
assert_select "osmChange[version='#{API_VERSION}'][generator='#{GENERATOR}']" do
assert_select "create", :count => 5
- assert_select "create>node[id=#{nodes(:used_node_2).node_id}][visible=#{nodes(:used_node_2).visible?}][version=#{nodes(:used_node_2).version}]" do
- assert_select "tag[k=#{node_tags(:t3).k}][v=#{node_tags(:t3).v}]"
+ assert_select "create>node[id='#{nodes(:used_node_2).node_id}'][visible='#{nodes(:used_node_2).visible?}'][version='#{nodes(:used_node_2).version}']" do
+ assert_select "tag[k='#{node_tags(:t3).k}'][v='#{node_tags(:t3).v}']"
end
- assert_select "create>node[id=#{nodes(:visible_node).node_id}]"
+ assert_select "create>node[id='#{nodes(:visible_node).node_id}']"
end
end
# get the bounding box back from the changeset
get :read, :id => changeset_id
assert_response :success, "Couldn't read back changeset."
- assert_select "osm>changeset[min_lon=1.0]", 1
- assert_select "osm>changeset[max_lon=1.0]", 1
- assert_select "osm>changeset[min_lat=2.0]", 1
- assert_select "osm>changeset[max_lat=2.0]", 1
+ assert_select "osm>changeset[min_lon='1.0']", 1
+ assert_select "osm>changeset[max_lon='1.0']", 1
+ assert_select "osm>changeset[min_lat='2.0']", 1
+ assert_select "osm>changeset[max_lat='2.0']", 1
# add another node to it
with_controller(NodeController.new) do
# get the bounding box back from the changeset
get :read, :id => changeset_id
assert_response :success, "Couldn't read back changeset for the second time."
- assert_select "osm>changeset[min_lon=1.0]", 1
- assert_select "osm>changeset[max_lon=2.0]", 1
- assert_select "osm>changeset[min_lat=1.0]", 1
- assert_select "osm>changeset[max_lat=2.0]", 1
+ assert_select "osm>changeset[min_lon='1.0']", 1
+ assert_select "osm>changeset[max_lon='2.0']", 1
+ assert_select "osm>changeset[min_lat='1.0']", 1
+ assert_select "osm>changeset[max_lat='2.0']", 1
# add (delete) a way to it, which contains a point at (3,3)
with_controller(WayController.new) do
get :read, :id => changeset_id
assert_response :success, "Couldn't read back changeset for the third time."
# note that the 3.1 here is because of the bbox overexpansion
- assert_select "osm>changeset[min_lon=1.0]", 1
- assert_select "osm>changeset[max_lon=3.1]", 1
- assert_select "osm>changeset[min_lat=1.0]", 1
- assert_select "osm>changeset[max_lat=3.1]", 1
+ assert_select "osm>changeset[min_lon='1.0']", 1
+ assert_select "osm>changeset[max_lon='3.1']", 1
+ assert_select "osm>changeset[min_lat='1.0']", 1
+ assert_select "osm>changeset[max_lat='3.1']", 1
end
##
put :update, :id => changeset.id
assert_response :success
- assert_select "osm>changeset[id=#{changeset.id}]", 1
+ assert_select "osm>changeset[id='#{changeset.id}']", 1
assert_select "osm>changeset>tag", 2
assert_select "osm>changeset>tag[k=tagtesting][v=valuetesting]", 1
end
assert_select "osmChange", 1
# this changeset contains node 17 in versions 1 & 2, but 1 should
# be hidden.
- assert_select "osmChange node[id=17]", 1
- assert_select "osmChange node[id=17][version=1]", 0
+ assert_select "osmChange node[id='17']", 1
+ assert_select "osmChange node[id='17'][version='1']", 0
end
##
def assert_changesets(ids)
assert_select "osm>changeset", ids.size
ids.each do |id|
- assert_select "osm>changeset[id=#{id}]", 1
+ assert_select "osm>changeset[id='#{id}']", 1
end
end
# check exactly one changeset
assert_select "osm>changeset", 1
- assert_select "osm>changeset[id=#{changeset_id}]", 1
+ assert_select "osm>changeset[id='#{changeset_id}']", 1
# check the bbox
doc = XML::Parser.string(@response.body).parse
assert_select "title", "OpenStreetMap | Send message"
assert_select "form[action='#{new_message_path(:display_name => users(:public_user).display_name)}']", :count => 1 do
assert_select "input#message_title", :count => 1 do
- assert_select "[value=Test Message]"
+ assert_select "[value='Test Message']"
end
assert_select "textarea#message_body", :text => "", :count => 1
assert_select "input[type='submit'][value='Send']", :count => 1
assert_select "title", "OpenStreetMap | Send message"
assert_select "form[action='#{new_message_path(:display_name => users(:public_user).display_name)}']", :count => 1 do
assert_select "input#message_title", :count => 1 do
- assert_select "[value=]"
+ assert_select "[value='']"
end
assert_select "textarea#message_body", :text => "Test message body", :count => 1
assert_select "input[type='submit'][value='Send']", :count => 1
assert_response :success
assert_select "osm" do
assert_select "node", :count => 5
- assert_select "node[id=1][visible=true]", :count => 1
- assert_select "node[id=2][visible=false]", :count => 1
- assert_select "node[id=4][visible=true]", :count => 1
- assert_select "node[id=15][visible=true]", :count => 1
- assert_select "node[id=17][visible=false]", :count => 1
+ assert_select "node[id='1'][visible='true']", :count => 1
+ assert_select "node[id='2'][visible='false']", :count => 1
+ assert_select "node[id='4'][visible='true']", :count => 1
+ assert_select "node[id='15'][visible='true']", :count => 1
+ assert_select "node[id='17'][visible='false']", :count => 1
end
# check error when a non-existent node is included
assert_response :success
assert_equal "application/xml", @response.content_type
assert_select "osm", :count => 1 do
- assert_select "note[lat=#{notes(:open_note).lat}][lon=#{notes(:open_note).lon}]", :count => 1 do
+ assert_select "note[lat='#{notes(:open_note).lat}'][lon='#{notes(:open_note).lon}']", :count => 1 do
assert_select "id", notes(:open_note).id
assert_select "url", note_url(notes(:open_note), :format => "xml")
assert_select "comment_url", comment_note_url(notes(:open_note), :format => "xml")
assert_response :success
assert_equal "application/gpx+xml", @response.content_type
assert_select "gpx", :count => 1 do
- assert_select "wpt[lat=#{notes(:open_note).lat}][lon=#{notes(:open_note).lon}]", :count => 1 do
+ assert_select "wpt[lat='#{notes(:open_note).lat}'][lon='#{notes(:open_note).lon}']", :count => 1 do
assert_select "extension", :count => 1 do
assert_select "id", notes(:open_note).id
assert_select "url", note_url(notes(:open_note), :format => "gpx")
get :history, :id => node.node_id
assert_response :success, "Redaction shouldn't have stopped history working."
- assert_select "osm node[id=#{node.node_id}][version=#{node.version}]", 0, "redacted node #{node.node_id} version #{node.version} shouldn't be present in the history."
+ assert_select "osm node[id='#{node.node_id}'][version='#{node.version}']", 0, "redacted node #{node.node_id} version #{node.version} shouldn't be present in the history."
# not even to a logged-in user
basic_authorization(users(:public_user).email, "test")
get :history, :id => node.node_id
assert_response :success, "Redaction shouldn't have stopped history working."
- assert_select "osm node[id=#{node.node_id}][version=#{node.version}]", 0, "redacted node #{node.node_id} version #{node.version} shouldn't be present in the history, even when logged in."
+ assert_select "osm node[id='#{node.node_id}'][version='#{node.version}']", 0, "redacted node #{node.node_id} version #{node.version} shouldn't be present in the history, even when logged in."
end
##
# and when accessed via history
get :history, :id => node.node_id
assert_response :success, "Redaction shouldn't have stopped history working."
- assert_select "osm node[id=#{node.node_id}][version=#{node.version}]", 0, "node #{node.node_id} version #{node.version} should not be present in the history for moderators when not passing flag."
+ assert_select "osm node[id='#{node.node_id}'][version='#{node.version}']", 0, "node #{node.node_id} version #{node.version} should not be present in the history for moderators when not passing flag."
get :history, :id => node.node_id, :show_redactions => 'true'
assert_response :success, "Redaction shouldn't have stopped history working."
- assert_select "osm node[id=#{node.node_id}][version=#{node.version}]", 1, "node #{node.node_id} version #{node.version} should still be present in the history for moderators when passing flag."
+ assert_select "osm node[id='#{node.node_id}'][version='#{node.version}']", 1, "node #{node.node_id} version #{node.version} should still be present in the history for moderators when passing flag."
end
# testing that if the moderator drops auth, he can't see the
# and when accessed via history
get :history, :id => node.node_id
assert_response :success, "Redaction shouldn't have stopped history working."
- assert_select "osm node[id=#{node.node_id}][version=#{node.version}]", 0, "redacted node #{node.node_id} version #{node.version} shouldn't be present in the history."
+ assert_select "osm node[id='#{node.node_id}'][version='#{node.version}']", 0, "redacted node #{node.node_id} version #{node.version} shouldn't be present in the history."
end
def do_redact_node(node, redaction)
get :history, :id => relation.relation_id
assert_response :success, "Redaction shouldn't have stopped history working."
- assert_select "osm relation[id=#{relation.relation_id}][version=#{relation.version}]", 0, "redacted relation #{relation.relation_id} version #{relation.version} shouldn't be present in the history."
+ assert_select "osm relation[id='#{relation.relation_id}'][version='#{relation.version}']", 0, "redacted relation #{relation.relation_id} version #{relation.version} shouldn't be present in the history."
# not even to a logged-in user
basic_authorization(users(:public_user).email, "test")
get :version, :id => relation.relation_id, :version => relation.version
get :history, :id => relation.relation_id
assert_response :success, "Redaction shouldn't have stopped history working."
- assert_select "osm relation[id=#{relation.relation_id}][version=#{relation.version}]", 0, "redacted node #{relation.relation_id} version #{relation.version} shouldn't be present in the history, even when logged in."
+ assert_select "osm relation[id='#{relation.relation_id}'][version='#{relation.version}']", 0, "redacted node #{relation.relation_id} version #{relation.version} shouldn't be present in the history, even when logged in."
end
##
# and when accessed via history
get :history, :id => relation.relation_id
assert_response :success, "Redaction shouldn't have stopped history working."
- assert_select "osm relation[id=#{relation.relation_id}][version=#{relation.version}]", 0, "relation #{relation.relation_id} version #{relation.version} should not be present in the history for moderators when not passing flag."
+ assert_select "osm relation[id='#{relation.relation_id}'][version='#{relation.version}']", 0, "relation #{relation.relation_id} version #{relation.version} should not be present in the history for moderators when not passing flag."
get :history, :id => relation.relation_id, :show_redactions => 'true'
assert_response :success, "Redaction shouldn't have stopped history working."
- assert_select "osm relation[id=#{relation.relation_id}][version=#{relation.version}]", 1, "relation #{relation.relation_id} version #{relation.version} should still be present in the history for moderators when passing flag."
+ assert_select "osm relation[id='#{relation.relation_id}'][version='#{relation.version}']", 1, "relation #{relation.relation_id} version #{relation.version} should still be present in the history for moderators when passing flag."
end
# testing that if the moderator drops auth, he can't see the
# and when accessed via history
get :history, :id => relation.relation_id
assert_response :success, "Redaction shouldn't have stopped history working."
- assert_select "osm relation[id=#{relation.relation_id}][version=#{relation.version}]", 0, "redacted relation #{relation.relation_id} version #{relation.version} shouldn't be present in the history."
+ assert_select "osm relation[id='#{relation.relation_id}'][version='#{relation.version}']", 0, "redacted relation #{relation.relation_id} version #{relation.version} shouldn't be present in the history."
end
##
get :history, :id => way.way_id
assert_response :success, "Redaction shouldn't have stopped history working."
- assert_select "osm way[id=#{way.way_id}][version=#{way.version}]", 0, "redacted way #{way.way_id} version #{way.version} shouldn't be present in the history."
+ assert_select "osm way[id='#{way.way_id}'][version='#{way.version}']", 0, "redacted way #{way.way_id} version #{way.version} shouldn't be present in the history."
# not even to a logged-in user
basic_authorization(users(:public_user).email, "test")
get :version, :id => way.way_id, :version => way.version
get :history, :id => way.way_id
assert_response :success, "Redaction shouldn't have stopped history working."
- assert_select "osm way[id=#{way.way_id}][version=#{way.version}]", 0, "redacted node #{way.way_id} version #{way.version} shouldn't be present in the history, even when logged in."
+ assert_select "osm way[id='#{way.way_id}'][version='#{way.version}']", 0, "redacted node #{way.way_id} version #{way.version} shouldn't be present in the history, even when logged in."
end
##
# and when accessed via history
get :history, :id => way.way_id
assert_response :success, "Redaction shouldn't have stopped history working."
- assert_select "osm way[id=#{way.way_id}][version=#{way.version}]", 0, "way #{way.way_id} version #{way.version} should not be present in the history for moderators when not passing flag."
+ assert_select "osm way[id='#{way.way_id}'][version='#{way.version}']", 0, "way #{way.way_id} version #{way.version} should not be present in the history for moderators when not passing flag."
get :history, :id => way.way_id, :show_redactions => 'true'
assert_response :success, "Redaction shouldn't have stopped history working."
- assert_select "osm way[id=#{way.way_id}][version=#{way.version}]", 1, "way #{way.way_id} version #{way.version} should still be present in the history for moderators when passing flag."
+ assert_select "osm way[id='#{way.way_id}'][version='#{way.version}']", 1, "way #{way.way_id} version #{way.version} should still be present in the history for moderators when passing flag."
end
# testing that if the moderator drops auth, he can't see the
# and when accessed via history
get :history, :id => way.way_id
assert_response :success, "Redaction shouldn't have stopped history working."
- assert_select "osm way[id=#{way.way_id}][version=#{way.version}]", 0, "redacted way #{way.way_id} version #{way.version} shouldn't be present in the history."
+ assert_select "osm way[id='#{way.way_id}'][version='#{way.version}']", 0, "redacted way #{way.way_id} version #{way.version} shouldn't be present in the history."
end
##
assert_response :success
# count one osm element
- assert_select "osm[version=#{API_VERSION}][generator=\"OpenStreetMap server\"]", 1
+ assert_select "osm[version='#{API_VERSION}'][generator='OpenStreetMap server']", 1
# we should have only the expected number of relations
assert_select "osm>relation", expected_relations.size
# and each of them should contain the node we originally searched for
expected_relations.each do |r|
relation_id = current_relations(r).id
- assert_select "osm>relation#?", relation_id
- assert_select "osm>relation#?>member[type=\"#{type}\"][ref=#{id}]", relation_id
+ assert_select "osm>relation[id='#{relation_id}']>member[type='#{type}'][ref='#{id}']", 1
end
end
assert_response :success
assert_select "osm" do
assert_select "relation", :count => 4
- assert_select "relation[id=1][visible=true]", :count => 1
- assert_select "relation[id=2][visible=false]", :count => 1
- assert_select "relation[id=4][visible=true]", :count => 1
- assert_select "relation[id=7][visible=true]", :count => 1
+ assert_select "relation[id='1'][visible='true']", :count => 1
+ assert_select "relation[id='2'][visible='false']", :count => 1
+ assert_select "relation[id='4'][visible='true']", :count => 1
+ assert_select "relation[id='7'][visible='true']", :count => 1
end
# check error when a non-existent relation is included
get :read, :id => changeset_id
assert_response :success, "can't re-read changeset for modify test"
assert_select "osm>changeset", 1, "Changeset element doesn't exist in #{@response.body}"
- assert_select "osm>changeset[id=#{changeset_id}]", 1, "Changeset id=#{changeset_id} doesn't exist in #{@response.body}"
- assert_select "osm>changeset[min_lon=#{bbox.min_lon}]", 1, "Changeset min_lon wrong in #{@response.body}"
- assert_select "osm>changeset[min_lat=#{bbox.min_lat}]", 1, "Changeset min_lat wrong in #{@response.body}"
- assert_select "osm>changeset[max_lon=#{bbox.max_lon}]", 1, "Changeset max_lon wrong in #{@response.body}"
- assert_select "osm>changeset[max_lat=#{bbox.max_lat}]", 1, "Changeset max_lat wrong in #{@response.body}"
+ assert_select "osm>changeset[id='#{changeset_id}']", 1, "Changeset id=#{changeset_id} doesn't exist in #{@response.body}"
+ assert_select "osm>changeset[min_lon='#{bbox.min_lon}']", 1, "Changeset min_lon wrong in #{@response.body}"
+ assert_select "osm>changeset[min_lat='#{bbox.min_lat}']", 1, "Changeset min_lat wrong in #{@response.body}"
+ assert_select "osm>changeset[max_lon='#{bbox.max_lon}']", 1, "Changeset max_lon wrong in #{@response.body}"
+ assert_select "osm>changeset[max_lat='#{bbox.max_lat}']", 1, "Changeset max_lat wrong in #{@response.body}"
end
end
end
assert_select "body", :count => 1 do
assert_select "div#content", :count => 1 do
- assert_select "form[action='/user/new'][method=post]", :count => 1 do
- assert_select "input[id=user_email]", :count => 1
- assert_select "input[id=user_email_confirmation]", :count => 1
- assert_select "input[id=user_display_name]", :count => 1
- assert_select "input[id=user_pass_crypt][type=password]", :count => 1
- assert_select "input[id=user_pass_crypt_confirmation][type=password]", :count => 1
- assert_select "input[type=submit][value=Sign Up]", :count => 1
+ assert_select "form[action='/user/new'][method='post']", :count => 1 do
+ assert_select "input[id='user_email']", :count => 1
+ assert_select "input[id='user_email_confirmation']", :count => 1
+ assert_select "input[id='user_display_name']", :count => 1
+ assert_select "input[id='user_pass_crypt'][type='password']", :count => 1
+ assert_select "input[id='user_pass_crypt_confirmation'][type='password']", :count => 1
+ assert_select "input[type='submit'][value='Sign Up']", :count => 1
end
end
end
get :view, {:display_name => "test"}
assert_response :success
assert_select "div#userinformation" do
- assert_select "a[href^=/user/test/history]", 1
- assert_select "a[href=/user/test/traces]", 1
- assert_select "a[href=/user/test/diary]", 1
- assert_select "a[href=/user/test/diary/comments]", 1
- assert_select "a[href=/user/test/account]", 0
- assert_select "a[href=/user/test/blocks]", 0
- assert_select "a[href=/user/test/blocks_by]", 0
- assert_select "a[href=/blocks/new/test]", 0
+ assert_select "a[href^='/user/test/history']", 1
+ assert_select "a[href='/user/test/traces']", 1
+ assert_select "a[href='/user/test/diary']", 1
+ assert_select "a[href='/user/test/diary/comments']", 1
+ assert_select "a[href='/user/test/account']", 0
+ assert_select "a[href='/user/test/blocks']", 0
+ assert_select "a[href='/user/test/blocks_by']", 0
+ assert_select "a[href='/blocks/new/test']", 0
end
# Test a user who has been blocked
get :view, {:display_name => "blocked"}
assert_response :success
assert_select "div#userinformation" do
- assert_select "a[href^=/user/blocked/history]", 1
- assert_select "a[href=/user/blocked/traces]", 1
- assert_select "a[href=/user/blocked/diary]", 1
- assert_select "a[href=/user/blocked/diary/comments]", 1
- assert_select "a[href=/user/blocked/account]", 0
- assert_select "a[href=/user/blocked/blocks]", 1
- assert_select "a[href=/user/blocked/blocks_by]", 0
- assert_select "a[href=/blocks/new/blocked]", 0
+ assert_select "a[href^='/user/blocked/history']", 1
+ assert_select "a[href='/user/blocked/traces']", 1
+ assert_select "a[href='/user/blocked/diary']", 1
+ assert_select "a[href='/user/blocked/diary/comments']", 1
+ assert_select "a[href='/user/blocked/account']", 0
+ assert_select "a[href='/user/blocked/blocks']", 1
+ assert_select "a[href='/user/blocked/blocks_by']", 0
+ assert_select "a[href='/blocks/new/blocked']", 0
end
# Test a moderator who has applied blocks
get :view, {:display_name => "moderator"}
assert_response :success
assert_select "div#userinformation" do
- assert_select "a[href^=/user/moderator/history]", 1
- assert_select "a[href=/user/moderator/traces]", 1
- assert_select "a[href=/user/moderator/diary]", 1
- assert_select "a[href=/user/moderator/diary/comments]", 1
- assert_select "a[href=/user/moderator/account]", 0
- assert_select "a[href=/user/moderator/blocks]", 0
- assert_select "a[href=/user/moderator/blocks_by]", 1
- assert_select "a[href=/blocks/new/moderator]", 0
+ assert_select "a[href^='/user/moderator/history']", 1
+ assert_select "a[href='/user/moderator/traces']", 1
+ assert_select "a[href='/user/moderator/diary']", 1
+ assert_select "a[href='/user/moderator/diary/comments']", 1
+ assert_select "a[href='/user/moderator/account']", 0
+ assert_select "a[href='/user/moderator/blocks']", 0
+ assert_select "a[href='/user/moderator/blocks_by']", 1
+ assert_select "a[href='/blocks/new/moderator']", 0
end
# Login as a normal user
get :view, {:display_name => "test"}
assert_response :success
assert_select "div#userinformation" do
- assert_select "a[href^=/user/test/history]", 1
- assert_select "a[href=/traces/mine]", 1
- assert_select "a[href=/user/test/diary]", 1
- assert_select "a[href=/user/test/diary/comments]", 1
- assert_select "a[href=/user/test/account]", 1
- assert_select "a[href=/user/test/blocks]", 0
- assert_select "a[href=/user/test/blocks_by]", 0
- assert_select "a[href=/blocks/new/test]", 0
+ assert_select "a[href^='/user/test/history']", 1
+ assert_select "a[href='/traces/mine']", 1
+ assert_select "a[href='/user/test/diary']", 1
+ assert_select "a[href='/user/test/diary/comments']", 1
+ assert_select "a[href='/user/test/account']", 1
+ assert_select "a[href='/user/test/blocks']", 0
+ assert_select "a[href='/user/test/blocks_by']", 0
+ assert_select "a[href='/blocks/new/test']", 0
end
# Login as a moderator
get :view, {:display_name => "test"}
assert_response :success
assert_select "div#userinformation" do
- assert_select "a[href^=/user/test/history]", 1
- assert_select "a[href=/user/test/traces]", 1
- assert_select "a[href=/user/test/diary]", 1
- assert_select "a[href=/user/test/diary/comments]", 1
- assert_select "a[href=/user/test/account]", 0
- assert_select "a[href=/user/test/blocks]", 0
- assert_select "a[href=/user/test/blocks_by]", 0
- assert_select "a[href=/blocks/new/test]", 1
+ assert_select "a[href^='/user/test/history']", 1
+ assert_select "a[href='/user/test/traces']", 1
+ assert_select "a[href='/user/test/diary']", 1
+ assert_select "a[href='/user/test/diary/comments']", 1
+ assert_select "a[href='/user/test/account']", 0
+ assert_select "a[href='/user/test/blocks']", 0
+ assert_select "a[href='/user/test/blocks_by']", 0
+ assert_select "a[href='/blocks/new/test']", 1
end
end
# check the data that is returned
assert_select "description", :count => 1, :text => "test"
assert_select "contributor-terms", :count => 1 do
- assert_select "[agreed=true]"
+ assert_select "[agreed='true']"
end
assert_select "img", :count => 1
assert_select "roles", :count => 1 do
assert_select "role", :count => 0
end
assert_select "changesets", :count => 1 do
- assert_select "[count=0]"
+ assert_select "[count='0']"
end
assert_select "traces", :count => 1 do
- assert_select "[count=0]"
+ assert_select "[count='0']"
end
assert_select "blocks", :count => 1 do
assert_select "received", :count => 1 do
- assert_select "[count=0][active=0]"
+ assert_select "[count='0'][active='0']"
end
assert_select "issued", :count => 0
end
# check the data that is returned
assert_select "description", :count => 1, :text => "test"
assert_select "contributor-terms", :count => 1 do
- assert_select "[agreed=true][pd=false]"
+ assert_select "[agreed='true'][pd='false']"
end
assert_select "img", :count => 1
assert_select "roles", :count => 1 do
assert_select "role", :count => 0
end
assert_select "changesets", :count => 1 do
- assert_select "[count=0]", :count => 1
+ assert_select "[count='0']", :count => 1
end
assert_select "traces", :count => 1 do
- assert_select "[count=0]", :count => 1
+ assert_select "[count='0']", :count => 1
end
assert_select "blocks", :count => 1 do
assert_select "received", :count => 1 do
- assert_select "[count=0][active=0]"
+ assert_select "[count='0'][active='0']"
end
assert_select "issued", :count => 0
end
assert_select "home", :count => 1 do
- assert_select "[lat=12.1][lon=12.1][zoom=3]"
+ assert_select "[lat='12.1'][lon='12.1'][zoom='3']"
end
assert_select "languages", :count => 1 do
assert_select "lang", :count => 1, :text => "en"
end
assert_select "messages", :count => 1 do
assert_select "received", :count => 1 do
- assert_select "[count=1][unread=0]"
+ assert_select "[count='1'][unread='0']"
end
assert_select "sent", :count => 1 do
- assert_select "[count=1]"
+ assert_select "[count='1']"
end
end
end
assert_response :success
assert_template :make_friend
assert_select "form" do
- assert_select "input[type=hidden][name=referer]", 0
- assert_select "input[type=submit]", 1
+ assert_select "input[type='hidden'][name='referer']", 0
+ assert_select "input[type='submit']", 1
end
assert_nil Friend.where(:user_id => user.id, :friend_user_id => friend.id).first
assert_response :success
assert_template :make_friend
assert_select "form" do
- assert_select "input[type=hidden][name=referer][value=/test]", 1
- assert_select "input[type=submit]", 1
+ assert_select "input[type='hidden'][name='referer'][value='/test']", 1
+ assert_select "input[type='submit']", 1
end
assert_nil Friend.where(:user_id => user.id, :friend_user_id => friend.id).first
assert_response :success
assert_template :remove_friend
assert_select "form" do
- assert_select "input[type=hidden][name=referer]", 0
- assert_select "input[type=submit]", 1
+ assert_select "input[type='hidden'][name='referer']", 0
+ assert_select "input[type='submit']", 1
end
assert Friend.where(:user_id => user.id, :friend_user_id => friend.id).first
assert_response :success
assert_template :remove_friend
assert_select "form" do
- assert_select "input[type=hidden][name=referer][value=/test]", 1
- assert_select "input[type=submit]", 1
+ assert_select "input[type='hidden'][name='referer'][value='/test']", 1
+ assert_select "input[type='submit']", 1
end
assert Friend.where(:user_id => user.id, :friend_user_id => friend.id).first
assert_response :success
# Check the way is correctly returned
- assert_select "osm way[id=#{way.id}][version=#{way.version}][visible=#{way.visible}]", 1
+ assert_select "osm way[id='#{way.id}'][version='#{way.version}'][visible='#{way.visible}']", 1
# check that each node in the way appears once in the output as a
# reference and as the node element.
way.nodes.each do |n|
count = (way.nodes - (way.nodes - [n])).length
- assert_select "osm way nd[ref=#{n.id}]", count
- assert_select "osm node[id=#{n.id}][version=#{n.version}][lat=#{n.lat}][lon=#{n.lon}]", 1
+ assert_select "osm way nd[ref='#{n.id}']", count
+ assert_select "osm node[id='#{n.id}'][version='#{n.version}'][lat='#{n.lat}'][lon='#{n.lon}']", 1
end
end
end
assert_response :success
assert_select "osm" do
assert_select "way", :count => 4
- assert_select "way[id=1][visible=true]", :count => 1
- assert_select "way[id=2][visible=false]", :count => 1
- assert_select "way[id=4][visible=true]", :count => 1
- assert_select "way[id=6][visible=true]", :count => 1
+ assert_select "way[id='1'][visible='true']", :count => 1
+ assert_select "way[id='2'][visible='false']", :count => 1
+ assert_select "way[id='4'][visible='true']", :count => 1
+ assert_select "way[id='6'][visible='true']", :count => 1
end
# check error when a non-existent way is included
# check the full ways to ensure we're not missing anything
expected_way_ids.each do |id|
- way_xml = ways_xml.find("//osm/way[@id=#{id}]").first
+ way_xml = ways_xml.find("//osm/way[@id='#{id}']").first
assert_ways_are_equal(Way.find(id),
Way.from_xml_node(way_xml))
end