# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Layout/LineLength:
- Max: 370
+ Max: 250
# Offense count: 36
# Configuration parameters: AllowSafeAssignment.
end
assert_response :success, "Expected scucess with the map call"
assert_select "osm[version='#{Settings.api_version}'][generator='#{Settings.generator}']", :count => 1 do
- assert_select "bounds[minlon='#{format('%<lon>.7f', :lon => minlon)}'][minlat='#{format('%<lat>.7f', :lat => minlat)}'][maxlon='#{format('%<lon>.7f', :lon => maxlon)}'][maxlat='#{format('%<lat>.7f', :lat => maxlat)}']", :count => 1
- assert_select "node[id='#{node.id}'][lat='#{format('%<lat>.7f', :lat => node.lat)}'][lon='#{format('%<lon>.7f', :lon => node.lon)}'][version='#{node.version}'][changeset='#{node.changeset_id}'][visible='#{node.visible}'][timestamp='#{node.timestamp.xmlschema}']", :count => 1 do
+ assert_select "bounds[minlon='#{format('%<lon>.7f', :lon => minlon)}']" \
+ "[minlat='#{format('%<lat>.7f', :lat => minlat)}']" \
+ "[maxlon='#{format('%<lon>.7f', :lon => maxlon)}']" \
+ "[maxlat='#{format('%<lat>.7f', :lat => maxlat)}']", :count => 1
+ assert_select "node[id='#{node.id}']" \
+ "[lat='#{format('%<lat>.7f', :lat => node.lat)}']" \
+ "[lon='#{format('%<lon>.7f', :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='#{tag.k}'][v='#{tag.v}']"
end
get map_path(:bbox => bbox)
assert_response :success, "The map call should have succeeded"
assert_select "osm[version='#{Settings.api_version}'][generator='#{Settings.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='#{format('%<lat>.7f', :lat => node.lat)}'][lon='#{format('%<lon>.7f', :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='#{format('%<lat>.7f', :lat => node.lat)}']" \
+ "[lon='#{format('%<lon>.7f', :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='#{tag.k}'][v='#{tag.v}']"
end
get api_node_history_path(:id => node_v1.node_id)
assert_response :success, "Redaction shouldn't have stopped history working."
- assert_select "osm node[id='#{node_v1.node_id}'][version='#{node_v1.version}']", 0, "redacted node #{node_v1.node_id} version #{node_v1.version} shouldn't be present in the history."
+ assert_select "osm node[id='#{node_v1.node_id}'][version='#{node_v1.version}']", 0,
+ "redacted node #{node_v1.node_id} version #{node_v1.version} shouldn't be present in the history."
# not even to a logged-in user
auth_header = basic_authorization_header create(:user).email, "test"
get api_node_history_path(:id => node_v1.node_id), :headers => auth_header
assert_response :success, "Redaction shouldn't have stopped history working."
- assert_select "osm node[id='#{node_v1.node_id}'][version='#{node_v1.version}']", 0, "redacted node #{node_v1.node_id} version #{node_v1.version} shouldn't be present in the history, even when logged in."
+ assert_select "osm node[id='#{node_v1.node_id}'][version='#{node_v1.version}']", 0,
+ "redacted node #{node_v1.node_id} version #{node_v1.version} shouldn't be present in the history, even when logged in."
end
##
# and when accessed via history
get api_node_history_path(:id => node_v3.node_id)
assert_response :success, "Redaction shouldn't have stopped history working."
- assert_select "osm node[id='#{node_v3.node_id}'][version='#{node_v3.version}']", 0, "node #{node_v3.node_id} version #{node_v3.version} should not be present in the history for moderators when not passing flag."
+ assert_select "osm node[id='#{node_v3.node_id}'][version='#{node_v3.version}']", 0,
+ "node #{node_v3.node_id} version #{node_v3.version} should not be present in the history for moderators when not passing flag."
get api_node_history_path(:id => node_v3.node_id), :params => { :show_redactions => "true" }, :headers => auth_header
assert_response :success, "Redaction shouldn't have stopped history working."
- assert_select "osm node[id='#{node_v3.node_id}'][version='#{node_v3.version}']", 1, "node #{node_v3.node_id} version #{node_v3.version} should still be present in the history for moderators when passing flag."
+ assert_select "osm node[id='#{node_v3.node_id}'][version='#{node_v3.version}']", 1,
+ "node #{node_v3.node_id} version #{node_v3.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 api_node_history_path(:id => node_v3.node_id), :headers => auth_header
assert_response :success, "Redaction shouldn't have stopped history working."
- assert_select "osm node[id='#{node_v3.node_id}'][version='#{node_v3.version}']", 0, "redacted node #{node_v3.node_id} version #{node_v3.version} shouldn't be present in the history."
+ assert_select "osm node[id='#{node_v3.node_id}'][version='#{node_v3.version}']", 0,
+ "redacted node #{node_v3.node_id} version #{node_v3.version} shouldn't be present in the history."
end
##
# and when accessed via history
get api_node_history_path(:id => node_v1.node_id)
assert_response :success, "Unredaction shouldn't have stopped history working."
- assert_select "osm node[id='#{node_v1.node_id}'][version='#{node_v1.version}']", 1, "node #{node_v1.node_id} version #{node_v1.version} should now be present in the history for moderators without passing flag."
+ assert_select "osm node[id='#{node_v1.node_id}'][version='#{node_v1.version}']", 1,
+ "node #{node_v1.node_id} version #{node_v1.version} should now be present in the history for moderators without passing flag."
auth_header = basic_authorization_header create(:user).email, "test"
# and when accessed via history
get api_node_history_path(:id => node_v1.node_id)
assert_response :success, "Unredaction shouldn't have stopped history working."
- assert_select "osm node[id='#{node_v1.node_id}'][version='#{node_v1.version}']", 1, "node #{node_v1.node_id} version #{node_v1.version} should now be present in the history for normal users without passing flag."
+ assert_select "osm node[id='#{node_v1.node_id}'][version='#{node_v1.version}']", 1,
+ "node #{node_v1.node_id} version #{node_v1.version} should now be present in the history for normal users without passing flag."
end
private
get api_relation_history_path(:id => relation_v1.relation_id)
assert_response :success, "Redaction shouldn't have stopped history working."
- assert_select "osm relation[id='#{relation_v1.relation_id}'][version='#{relation_v1.version}']", 0, "redacted relation #{relation_v1.relation_id} version #{relation_v1.version} shouldn't be present in the history."
+ assert_select "osm relation[id='#{relation_v1.relation_id}'][version='#{relation_v1.version}']", 0,
+ "redacted relation #{relation_v1.relation_id} version #{relation_v1.version} shouldn't be present in the history."
# not even to a logged-in user
auth_header = basic_authorization_header create(:user).email, "test"
get relation_version_path(:id => relation_v1.relation_id, :version => relation_v1.version), :headers => auth_header
get api_relation_history_path(:id => relation_v1.relation_id), :headers => auth_header
assert_response :success, "Redaction shouldn't have stopped history working."
- assert_select "osm relation[id='#{relation_v1.relation_id}'][version='#{relation_v1.version}']", 0, "redacted relation #{relation_v1.relation_id} version #{relation_v1.version} shouldn't be present in the history, even when logged in."
+ assert_select "osm relation[id='#{relation_v1.relation_id}'][version='#{relation_v1.version}']", 0,
+ "redacted relation #{relation_v1.relation_id} version #{relation_v1.version} shouldn't be present in the history, even when logged in."
end
##
# and when accessed via history
get api_relation_history_path(:id => relation_v3.relation_id), :headers => auth_header
assert_response :success, "Redaction shouldn't have stopped history working."
- assert_select "osm relation[id='#{relation_v3.relation_id}'][version='#{relation_v3.version}']", 0, "relation #{relation_v3.relation_id} version #{relation_v3.version} should not be present in the history for moderators when not passing flag."
+ assert_select "osm relation[id='#{relation_v3.relation_id}'][version='#{relation_v3.version}']", 0,
+ "relation #{relation_v3.relation_id} version #{relation_v3.version} should not be present in the history for moderators when not passing flag."
get api_relation_history_path(:id => relation_v3.relation_id), :params => { :show_redactions => "true" }, :headers => auth_header
assert_response :success, "Redaction shouldn't have stopped history working."
- assert_select "osm relation[id='#{relation_v3.relation_id}'][version='#{relation_v3.version}']", 1, "relation #{relation_v3.relation_id} version #{relation_v3.version} should still be present in the history for moderators when passing flag."
+ assert_select "osm relation[id='#{relation_v3.relation_id}'][version='#{relation_v3.version}']", 1,
+ "relation #{relation_v3.relation_id} version #{relation_v3.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 api_relation_history_path(:id => relation_v3.relation_id), :headers => auth_header
assert_response :success, "Redaction shouldn't have stopped history working."
- assert_select "osm relation[id='#{relation_v3.relation_id}'][version='#{relation_v3.version}']", 0, "redacted relation #{relation_v3.relation_id} version #{relation_v3.version} shouldn't be present in the history."
+ assert_select "osm relation[id='#{relation_v3.relation_id}'][version='#{relation_v3.version}']", 0,
+ "redacted relation #{relation_v3.relation_id} version #{relation_v3.version} shouldn't be present in the history."
end
##
# and when accessed via history
get api_relation_history_path(:id => relation_v1.relation_id), :headers => auth_header
assert_response :success, "Redaction shouldn't have stopped history working."
- assert_select "osm relation[id='#{relation_v1.relation_id}'][version='#{relation_v1.version}']", 1, "relation #{relation_v1.relation_id} version #{relation_v1.version} should still be present in the history for moderators."
+ assert_select "osm relation[id='#{relation_v1.relation_id}'][version='#{relation_v1.version}']", 1,
+ "relation #{relation_v1.relation_id} version #{relation_v1.version} should still be present in the history for moderators."
auth_header = basic_authorization_header create(:user).email, "test"
# and when accessed via history
get api_relation_history_path(:id => relation_v1.relation_id), :headers => auth_header
assert_response :success, "Redaction shouldn't have stopped history working."
- assert_select "osm relation[id='#{relation_v1.relation_id}'][version='#{relation_v1.version}']", 1, "relation #{relation_v1.relation_id} version #{relation_v1.version} should still be present in the history for normal users."
+ assert_select "osm relation[id='#{relation_v1.relation_id}'][version='#{relation_v1.version}']", 1,
+ "relation #{relation_v1.relation_id} version #{relation_v1.version} should still be present in the history for normal users."
end
private
get api_way_history_path(:id => way_v1.way_id)
assert_response :success, "Redaction shouldn't have stopped history working."
- assert_select "osm way[id='#{way_v1.way_id}'][version='#{way_v1.version}']", 0, "redacted way #{way_v1.way_id} version #{way_v1.version} shouldn't be present in the history."
+ assert_select "osm way[id='#{way_v1.way_id}'][version='#{way_v1.version}']", 0,
+ "redacted way #{way_v1.way_id} version #{way_v1.version} shouldn't be present in the history."
# not even to a logged-in user
auth_header = basic_authorization_header create(:user).email, "test"
get way_version_path(:id => way_v1.way_id, :version => way_v1.version), :headers => auth_header
get api_way_history_path(:id => way_v1.way_id), :headers => auth_header
assert_response :success, "Redaction shouldn't have stopped history working."
- assert_select "osm way[id='#{way_v1.way_id}'][version='#{way_v1.version}']", 0, "redacted node #{way_v1.way_id} version #{way_v1.version} shouldn't be present in the history, even when logged in."
+ assert_select "osm way[id='#{way_v1.way_id}'][version='#{way_v1.version}']", 0,
+ "redacted node #{way_v1.way_id} version #{way_v1.version} shouldn't be present in the history, even when logged in."
end
##
# and when accessed via history
get api_way_history_path(:id => way_v3.way_id), :headers => auth_header
assert_response :success, "Redaction shouldn't have stopped history working."
- assert_select "osm way[id='#{way_v3.way_id}'][version='#{way_v3.version}']", 0, "way #{way_v3.way_id} version #{way_v3.version} should not be present in the history for moderators when not passing flag."
+ assert_select "osm way[id='#{way_v3.way_id}'][version='#{way_v3.version}']", 0,
+ "way #{way_v3.way_id} version #{way_v3.version} should not be present in the history for moderators when not passing flag."
get api_way_history_path(:id => way_v3.way_id), :params => { :show_redactions => "true" }, :headers => auth_header
assert_response :success, "Redaction shouldn't have stopped history working."
- assert_select "osm way[id='#{way_v3.way_id}'][version='#{way_v3.version}']", 1, "way #{way_v3.way_id} version #{way_v3.version} should still be present in the history for moderators when passing flag."
+ assert_select "osm way[id='#{way_v3.way_id}'][version='#{way_v3.version}']", 1,
+ "way #{way_v3.way_id} version #{way_v3.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 api_way_history_path(:id => way_v3.way_id), :headers => auth_header
assert_response :success, "Redaction shouldn't have stopped history working."
- assert_select "osm way[id='#{way_v3.way_id}'][version='#{way_v3.version}']", 0, "redacted way #{way_v3.way_id} version #{way_v3.version} shouldn't be present in the history."
+ assert_select "osm way[id='#{way_v3.way_id}'][version='#{way_v3.version}']", 0,
+ "redacted way #{way_v3.way_id} version #{way_v3.version} shouldn't be present in the history."
end
##
# and when accessed via history
get api_way_history_path(:id => way_v1.way_id), :headers => auth_header
assert_response :success, "Unredaction shouldn't have stopped history working."
- assert_select "osm way[id='#{way_v1.way_id}'][version='#{way_v1.version}']", 1, "way #{way_v1.way_id} version #{way_v1.version} should still be present in the history for moderators."
+ assert_select "osm way[id='#{way_v1.way_id}'][version='#{way_v1.version}']", 1,
+ "way #{way_v1.way_id} version #{way_v1.version} should still be present in the history for moderators."
auth_header = basic_authorization_header create(:user).email, "test"
# and when accessed via history
get api_way_history_path(:id => way_v1.way_id), :headers => auth_header
assert_response :success, "Redaction shouldn't have stopped history working."
- assert_select "osm way[id='#{way_v1.way_id}'][version='#{way_v1.version}']", 1, "way #{way_v1.way_id} version #{way_v1.version} should still be present in the history for normal users."
+ assert_select "osm way[id='#{way_v1.way_id}'][version='#{way_v1.version}']", 1,
+ "way #{way_v1.way_id} version #{way_v1.version} should still be present in the history for normal users."
end
private
assert_dom_equal "<a title=\"The Q42 item on Wikidata\" href=\"//www.wikidata.org/entity/Q42?uselang=en\">Q42</a>", html
html = format_value("operator:wikidata", "Q12;Q98")
- assert_dom_equal "<a title=\"The Q12 item on Wikidata\" href=\"//www.wikidata.org/entity/Q12?uselang=en\">Q12</a>;<a title=\"The Q98 item on Wikidata\" href=\"//www.wikidata.org/entity/Q98?uselang=en\">Q98</a>", html
+ assert_dom_equal "<a title=\"The Q12 item on Wikidata\" href=\"//www.wikidata.org/entity/Q12?uselang=en\">Q12</a>;" \
+ "<a title=\"The Q98 item on Wikidata\" href=\"//www.wikidata.org/entity/Q98?uselang=en\">Q98</a>", html
html = format_value("name:etymology:wikidata", "Q123")
assert_dom_equal "<a title=\"The Q123 item on Wikidata\" href=\"//www.wikidata.org/entity/Q123?uselang=en\">Q123</a>", html
assert_equal "de", Locale.available.preferred(Locale.list("zh-Hant", "de")).to_s
assert_equal "zh-TW", Locale.available.preferred(Locale.list("zh-Hant-TW", "de")).to_s
assert_equal "zh-TW", Locale.available.preferred(Locale.list("zh-TW", "de")).to_s
- assert_equal "zh-HK", Locale.available.preferred(Locale.list("zh-HK", "zh-hk", "zh-Hant", "zh-hant", "zh-TW", "zh-tw", "zh", "zh-yue", "yue", "yue-Hant", "yue-HK", "yue-Hans", "zh-classical", "lzh", "ja-Hani", "ko-Hani", "ko_hanja", "vi-Hani", "ja-hani", "ko-hani", "vi-hani", "en-HK", "en-hk", "en-SG", "en-sg", "en-GB", "en-gb", "en-US", "en-us", "en", "ja")).to_s
+ assert_equal "zh-HK", Locale.available.preferred(
+ Locale.list("zh-HK", "zh-hk", "zh-Hant", "zh-hant", "zh-TW", "zh-tw", "zh", "zh-yue",
+ "yue", "yue-Hant", "yue-HK", "yue-Hans", "zh-classical", "lzh", "ja-Hani",
+ "ko-Hani", "ko_hanja", "vi-Hani", "ja-hani", "ko-hani", "vi-hani", "en-HK",
+ "en-hk", "en-SG", "en-sg", "en-GB", "en-gb", "en-US", "en-us", "en", "ja")
+ ).to_s
assert_equal "en", Locale.available.preferred(Locale.list("yue")).to_s
end
end