assert_equal Settings.api_version, js["version"]
assert_equal Settings.generator, js["generator"]
assert_equal changeset.id, js["changeset"]["id"]
- assert js["changeset"]["open"]
+ assert_operator js["changeset"], :[], "open"
assert_equal changeset.created_at.xmlschema, js["changeset"]["created_at"]
assert_nil js["changeset"]["closed_at"]
assert_nil js["changeset"]["tags"]
assert_equal Settings.api_version, js["version"]
assert_equal Settings.generator, js["generator"]
assert_equal changeset.id, js["changeset"]["id"]
- assert js["changeset"]["open"]
+ assert_operator js["changeset"], :[], "open"
assert_equal changeset.created_at.xmlschema, js["changeset"]["created_at"]
assert_nil js["changeset"]["closed_at"]
assert_nil js["changeset"]["tags"]
# check that the changeset bbox is within bounds
cs = Changeset.find(changeset_id)
- assert cs.min_lon >= -180 * GeoRecord::SCALE, "Minimum longitude (#{cs.min_lon / GeoRecord::SCALE}) should be >= -180 to be valid."
- assert cs.max_lon <= 180 * GeoRecord::SCALE, "Maximum longitude (#{cs.max_lon / GeoRecord::SCALE}) should be <= 180 to be valid."
- assert cs.min_lat >= -90 * GeoRecord::SCALE, "Minimum latitude (#{cs.min_lat / GeoRecord::SCALE}) should be >= -90 to be valid."
- assert cs.max_lat <= 90 * GeoRecord::SCALE, "Maximum latitude (#{cs.max_lat / GeoRecord::SCALE}) should be <= 90 to be valid."
+ assert_operator cs.min_lon, :>=, -180 * GeoRecord::SCALE, "Minimum longitude (#{cs.min_lon / GeoRecord::SCALE}) should be >= -180 to be valid."
+ assert_operator cs.max_lon, :<=, 180 * GeoRecord::SCALE, "Maximum longitude (#{cs.max_lon / GeoRecord::SCALE}) should be <= 180 to be valid."
+ assert_operator cs.min_lat, :>=, -90 * GeoRecord::SCALE, "Minimum latitude (#{cs.min_lat / GeoRecord::SCALE}) should be >= -90 to be valid."
+ assert_operator cs.max_lat, :<=, 90 * GeoRecord::SCALE, "Maximum latitude (#{cs.max_lat / GeoRecord::SCALE}) should be <= 90 to be valid."
end
##
# valid delete should return the new version number, which should
# be greater than the old version number
- assert @response.body.to_i > node.version,
- "delete request should return a new version number for node"
+ assert_operator @response.body.to_i, :>, node.version, "delete request should return a new version number for node"
# deleting the same node twice doesn't work
xml = xml_for_node(node)
# valid delete should return the new version number, which should
# be greater than the old version number
- assert @response.body.to_i > multi_tag_relation.version,
- "delete request should return a new version number for relation"
+ assert_operator @response.body.to_i, :>, multi_tag_relation.version, "delete request should return a new version number for relation"
# this won't work since the relation is already deleted
xml = update_changeset(xml_for_relation(deleted_relation), changeset.id)
def check_json_details(js, user, include_private, include_email)
assert_equal user.id, js["user"]["id"]
assert_equal user.description, js["user"]["description"]
- assert js["user"]["contributor_terms"]["agreed"]
+ assert_operator js["user"]["contributor_terms"], :[], "agreed"
if include_private
assert_not js["user"]["contributor_terms"]["pd"]
# check the returned value - should be the new version number
# valid delete should return the new version number, which should
# be greater than the old version number
- assert @response.body.to_i > way.version,
- "delete request should return a new version number for way"
+ assert_operator @response.body.to_i, :>, way.version, "delete request should return a new version number for way"
# this won't work since the way is already deleted
xml = xml_for_way(deleted_way)
##
# check the result of a feed
def check_feed_result(changesets)
- assert changesets.size <= 20
+ assert_operator changesets.size, :<=, 20
assert_select "feed", :count => [changesets.size, 1].min do
assert_select "> title", :count => 1, :text => /^Changesets/
assert_response :success
assert_template "revoke"
b = UserBlock.find(active_block.id)
- assert b.ends_at - Time.now.utc > 100
+ assert_operator b.ends_at - Time.now.utc, :>, 100
# Check that revoking a block works using POST
post revoke_user_block_path(:id => active_block, :confirm => true)
end
def test_available
- assert Locale.available.count <= I18n.available_locales.count
+ assert_operator Locale.available.count, :<=, I18n.available_locales.count
end
def test_preferred
format = Argon2::HashFormat.new(hash)
assert_equal "argon2id", format.variant
- assert format.version <= 19
+ assert_operator format.version, :<=, 19
end
end
# smaller range.
distance = Math.sqrt(((lat - lat2)**2) + ((lon - lon2)**2))
max_distance = 360.0 / (1 << (zoom + 8)) * 0.5 * Math.sqrt(5)
- assert max_distance > distance, "Maximum expected error exceeded: #{max_distance} <= #{distance} for (#{lat}, #{lon}, #{zoom})."
+ assert_operator max_distance, :>, distance, "Maximum expected error exceeded: #{max_distance} <= #{distance} for (#{lat}, #{lon}, #{zoom})."
end
end
test "the status is deleted and the personal data removed" do
visit edit_account_path
- click_on "Delete Account..."
+ click_link "Delete Account..."
accept_confirm do
- click_on "Delete Account"
+ click_link "Delete Account"
end
assert_current_path root_path
test "the user is signed out after deletion" do
visit edit_account_path
- click_on "Delete Account..."
+ click_link "Delete Account..."
accept_confirm do
- click_on "Delete Account"
+ click_link "Delete Account"
end
assert_content "Log In"
test "the user is shown a confirmation flash message" do
visit edit_account_path
- click_on "Delete Account..."
+ click_link "Delete Account..."
accept_confirm do
- click_on "Delete Account"
+ click_link "Delete Account"
end
assert_content "Account Deleted"
sign_in_as(create(:user))
visit diary_entries_path
- click_on "Send a message to the author"
+ click_link "Send a message to the author"
assert_content "Send a new message"
assert_equal "Re: #{@diary_entry.title}", page.find_field("Subject").value
# No issues against the user
visit issues_path
fill_in "search_by_user", :with => good_user.display_name
- click_on "Search"
+ click_button "Search"
assert_no_content I18n.t("issues.index.user_not_found")
assert_content I18n.t("issues.index.issues_not_found")
# User doesn't exist
visit issues_path
fill_in "search_by_user", :with => "Nonexistent User"
- click_on "Search"
+ click_button "Search"
assert_content I18n.t("issues.index.user_not_found")
assert_content I18n.t("issues.index.issues_not_found")
# Find Issue against bad_user
visit issues_path
fill_in "search_by_user", :with => bad_user.display_name
- click_on "Search"
+ click_button "Search"
assert_no_content I18n.t("issues.index.user_not_found")
assert_no_content I18n.t("issues.index.issues_not_found")
end
visit issue_path(issue)
fill_in :issue_comment_body, :with => "test comment"
- click_on "Add Comment"
+ click_button "Add Comment"
assert_content I18n.t("issue_comments.create.comment_created")
assert_content "test comment"
fill_in :issue_comment_body, :with => "reassigning to moderators"
check :reassign
- click_on "Add Comment"
+ click_button "Add Comment"
assert_content "and the issue was reassigned"
assert_current_path issues_path(:status => "open")
fill_in :issue_comment_body, :with => "reassigning to moderators"
check :reassign
- click_on "Add Comment"
+ click_button "Add Comment"
assert_content "and the issue was reassigned"
assert_current_path issue_path(issue)
sign_in_as(create(:user))
visit edit_preferences_path
- click_on "Update Preferences"
+ click_button "Update Preferences"
assert_content "Preferences updated"
end
visit edit_preferences_path
fill_in "Preferred Languages", :with => "fr"
- click_on "Update Preferences"
+ click_button "Update Preferences"
assert_content "Préférences mises à jour"
end
visit diary_entry_path(@diary_entry.user.display_name, @diary_entry)
assert_content @diary_entry.title
- click_on I18n.t("diary_entries.diary_comment.report")
+ click_link I18n.t("diary_entries.diary_comment.report")
assert_content "Report"
assert_content I18n.t("reports.new.disclaimer.intro")
choose I18n.t("reports.new.categories.diary_comment.spam_label")
fill_in "report_details", :with => "This comment is spam"
assert_difference "Issue.count", 1 do
- click_on "Create Report"
+ click_button "Create Report"
end
assert_content "Your report has been registered successfully"
visit diary_entry_path(@diary_entry.user.display_name, @diary_entry)
assert_content @diary_entry.title
- click_on I18n.t("diary_entries.diary_entry.report")
+ click_link I18n.t("diary_entries.diary_entry.report")
assert_content "Report"
assert_content I18n.t("reports.new.disclaimer.intro")
choose I18n.t("reports.new.categories.diary_entry.spam_label")
fill_in "report_details", :with => "This is advertising"
assert_difference "Issue.count", 1 do
- click_on "Create Report"
+ click_button "Create Report"
end
assert_content "Your report has been registered successfully"
visit diary_entry_path(@diary_entry.user.display_name, @diary_entry)
assert_content @diary_entry.title
- click_on I18n.t("diary_entries.diary_entry.report")
+ click_link I18n.t("diary_entries.diary_entry.report")
assert_content "Report"
assert_content I18n.t("reports.new.disclaimer.intro")
choose I18n.t("reports.new.categories.diary_entry.spam_label")
fill_in "report_details", :with => "This is advertising"
assert_no_difference "Issue.count" do
- click_on "Create Report"
+ click_button "Create Report"
end
issue.reload
sign_in_as(create(:user))
visit note_path(note)
- click_on I18n.t("notes.show.report")
+ click_link I18n.t("notes.show.report")
assert_content "Report"
assert_content I18n.t("reports.new.disclaimer.intro")
choose I18n.t("reports.new.categories.note.spam_label")
fill_in "report_details", :with => "This is spam"
assert_difference "Issue.count", 1 do
- click_on "Create Report"
+ click_button "Create Report"
end
assert_content "Your report has been registered successfully"
sign_in_as(create(:user))
visit note_path(note)
- click_on I18n.t("notes.show.report")
+ click_link I18n.t("notes.show.report")
assert_content "Report"
assert_content I18n.t("reports.new.disclaimer.intro")
choose I18n.t("reports.new.categories.note.spam_label")
fill_in "report_details", :with => "This is spam"
assert_difference "Issue.count", 1 do
- click_on "Create Report"
+ click_button "Create Report"
end
assert_content "Your report has been registered successfully"
sign_in_as(create(:user))
visit user_path(user)
- click_on I18n.t("users.show.report")
+ click_link I18n.t("users.show.report")
assert_content "Report"
assert_content I18n.t("reports.new.disclaimer.intro")
choose I18n.t("reports.new.categories.user.vandal_label")
fill_in "report_details", :with => "This user is a vandal"
assert_difference "Issue.count", 1 do
- click_on "Create Report"
+ click_button "Create Report"
end
assert_content "Your report has been registered successfully"
sign_in_as(create(:user))
visit user_path(user)
- click_on I18n.t("users.show.report")
+ click_link I18n.t("users.show.report")
assert_content "Report"
assert_content I18n.t("reports.new.disclaimer.intro")
choose I18n.t("reports.new.categories.user.vandal_label")
fill_in "report_details", :with => "This user is a vandal"
assert_difference "Issue.count", 1 do
- click_on "Create Report"
+ click_button "Create Report"
end
assert_content "Your report has been registered successfully"
visit user_path(user)
- click_on I18n.t("users.show.report")
+ click_link I18n.t("users.show.report")
assert_content "Report"
assert_content I18n.t("reports.new.disclaimer.intro")
choose I18n.t("reports.new.categories.user.spam_label")
fill_in "report_details", :with => "This user is a spammer"
assert_no_difference "Issue.count" do
- click_on "Create Report"
+ click_button "Create Report"
end
assert_content "Your report has been registered successfully"
sign_in_as(user)
assert_no_content "Log In"
- click_on user.display_name
- click_on "Log Out"
+ click_button user.display_name
+ click_link "Log Out"
assert_content "Log In"
end
visit traces_path
assert_no_content "Log In"
- click_on user.display_name
- click_on "Log Out"
+ click_button user.display_name
+ click_link "Log Out"
assert_content "Log In"
assert_content "Public GPS Traces"
end
test "Sign up from login page" do
visit login_path
- click_on "Register now"
+ click_link "Register now"
assert_content "Confirm Password"
end
user = build(:user)
visit root_path
- click_on "Sign Up"
+ click_link "Sign Up"
fill_in "Email", :with => user.email
fill_in "Email Confirmation", :with => user.email
fill_in "Display Name", :with => user.display_name
click_button "Sign Up"
assert_content "Contributor terms"
- click_on "Cancel"
+ click_button "Cancel"
assert_current_path "https://wiki.openstreetmap.org/wiki/Contributor_Terms_Declined"
end
user = create(:user, :suspended)
visit user_path(user)
accept_confirm do
- click_on "Unsuspend"
+ click_link "Unsuspend"
end
assert_no_content "Unsuspend"
user = create(:user, :suspended)
visit user_path(user)
accept_confirm do
- click_on "Confirm"
+ click_link "Confirm"
end
assert_no_content "Unsuspend"
visit edit_preferences_path
fill_in "Preferred Languages", :with => "fr"
- click_on "Update Preferences"
+ click_button "Update Preferences"
visit "/communities"
assert_link "OpenStreetMap États-Unis", :href => "https://www.openstreetmap.us/"
visit login_path
fill_in "username", :with => user.email
fill_in "password", :with => "test"
- click_on "Login", :match => :first
+ click_button "Login", :match => :first
end
def session_for(user)