- rubocop-rails
- rubocop-rake
+# Offense count: 11
+# Configuration parameters: Include, MaxAmount
+FactoryBot/ExcessiveCreateList:
+ MaxAmount: 200
+
# Offense count: 557
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
test "the status is deleted and the personal data removed" do
visit edit_account_path
- click_link "Delete Account..."
+ click_on "Delete Account..."
accept_confirm do
- click_link "Delete Account"
+ click_on "Delete Account"
end
assert_current_path root_path
test "the user is signed out after deletion" do
visit edit_account_path
- click_link "Delete Account..."
+ click_on "Delete Account..."
accept_confirm do
- click_link "Delete Account"
+ click_on "Delete Account"
end
assert_content "Log In"
test "the user is shown a confirmation flash message" do
visit edit_account_path
- click_link "Delete Account..."
+ click_on "Delete Account..."
accept_confirm do
- click_link "Delete Account"
+ click_on "Delete Account"
end
assert_content "Account Deleted"
travel 1.hour do
visit edit_account_path
- click_link "Delete Account..."
+ click_on "Delete Account..."
assert_no_content "cannot currently be deleted"
end
travel 1.hour do
visit edit_account_path
- click_link "Delete Account..."
+ click_on "Delete Account..."
assert_no_content "cannot currently be deleted"
end
travel 12.hours do
visit edit_account_path
- click_link "Delete Account..."
+ click_on "Delete Account..."
assert_no_content "cannot currently be deleted"
end
travel 10.hours do
visit edit_account_path
- click_link "Delete Account..."
+ click_on "Delete Account..."
assert_content "cannot currently be deleted"
assert_content "in about 1 hour"
@user = build(:user)
visit user_new_path
- fill_in "Email", :with => @user.email
- fill_in "Email Confirmation", :with => @user.email
- fill_in "Display Name", :with => @user.display_name
- fill_in "Password", :with => "testtest"
- fill_in "Confirm Password", :with => "testtest"
- click_button "Sign Up"
+ within ".new_user" do
+ fill_in "Email", :with => @user.email
+ fill_in "Email Confirmation", :with => @user.email
+ fill_in "Display Name", :with => @user.display_name
+ fill_in "Password", :with => "testtest"
+ fill_in "Confirm Password", :with => "testtest"
+ click_on "Sign Up"
+ end
check "I have read and agree to the above contributor terms"
check "I have read and agree to the Terms of Use"
- click_button "Continue"
+ click_on "Continue"
end
test "flash message should not contain raw html" do
sign_in_as(create(:user))
visit diary_entries_path
- click_link "Send a message to the author"
+ click_on "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_button "Search"
+ click_on "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_button "Search"
+ click_on "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_button "Search"
+ click_on "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_button "Add Comment"
+ click_on "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_button "Add Comment"
+ click_on "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_button "Add Comment"
+ click_on "Add Comment"
assert_content "and the issue was reassigned"
assert_current_path issue_path(issue)
visit inbox_messages_path
assert_text "You have 1 new message and 0 old messages"
- click_button "Delete"
+ click_on "Delete"
assert_text "You have 0 new messages and 0 old messages"
end
visit outbox_messages_path
assert_text "You have 1 sent message"
- click_button "Delete"
+ click_on "Delete"
assert_text "You have 0 sent messages"
end
visit muted_messages_path
assert_text "1 muted message"
- click_button "Delete"
+ click_on "Delete"
assert_text "0 muted messages"
end
end
assert_button "Comment & Resolve"
assert_button "Comment", :disabled => false
- click_button "Comment"
+ click_on "Comment"
assert_content "Comment from #{user.display_name}"
assert_content "Some newly added note comment"
assert_text "OpenStreetMap Web Site"
accept_alert do
- click_link "Revoke Access"
+ click_on "Revoke Access"
end
assert_text "You have not yet authorized any OAuth 2 applications."
sign_in_as(create(:user))
visit edit_preferences_path
- click_button "Update Preferences"
+ click_on "Update Preferences"
assert_content "Preferences updated"
end
visit edit_preferences_path
fill_in "Preferred Languages", :with => "fr"
- click_button "Update Preferences"
+ click_on "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_link I18n.t("diary_entries.diary_comment.report")
+ click_on 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_button "Create Report"
+ click_on "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_link I18n.t("diary_entries.diary_entry.report")
+ click_on 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_button "Create Report"
+ click_on "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_link I18n.t("diary_entries.diary_entry.report")
+ click_on 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_button "Create Report"
+ click_on "Create Report"
end
issue.reload
sign_in_as(create(:user))
visit note_path(note)
- click_link I18n.t("notes.show.report")
+ click_on 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_button "Create Report"
+ click_on "Create Report"
end
assert_content "Your report has been registered successfully"
sign_in_as(create(:user))
visit note_path(note)
- click_link I18n.t("notes.show.report")
+ click_on 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_button "Create Report"
+ click_on "Create Report"
end
assert_content "Your report has been registered successfully"
sign_in_as(create(:user))
visit user_path(user)
- click_link I18n.t("users.show.report")
+ click_on 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_button "Create Report"
+ click_on "Create Report"
end
assert_content "Your report has been registered successfully"
sign_in_as(create(:user))
visit user_path(user)
- click_link I18n.t("users.show.report")
+ click_on 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_button "Create Report"
+ click_on "Create Report"
end
assert_content "Your report has been registered successfully"
visit user_path(user)
- click_link I18n.t("users.show.report")
+ click_on 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_button "Create Report"
+ click_on "Create Report"
end
assert_content "Your report has been registered successfully"
visit user_path(blocked_user)
assert_link "Revoke all blocks"
- click_link "Revoke all blocks"
+ click_on "Revoke all blocks"
assert_title "Revoking all blocks on #{blocked_user.display_name}"
assert_text "Revoking all blocks on #{blocked_user.display_name}"
assert_unchecked_field "Are you sure you wish to revoke 1 active block?"
visit user_path(blocked_user)
assert_link "Revoke all blocks"
- click_link "Revoke all blocks"
+ click_on "Revoke all blocks"
assert_title "Revoking all blocks on #{blocked_user.display_name}"
assert_text "Revoking all blocks on #{blocked_user.display_name}"
assert_unchecked_field "Are you sure you wish to revoke 2 active blocks?"
sign_in_as(user)
assert_no_content "Log In"
- click_button user.display_name
- click_link "Log Out"
+ click_on user.display_name
+ click_on "Log Out"
assert_content "Log In"
end
visit traces_path
assert_no_content "Log In"
- click_button user.display_name
- click_link "Log Out"
+ click_on user.display_name
+ click_on "Log Out"
assert_content "Log In"
assert_content "Public GPS Traces"
end
visit logout_path
assert_content "Logout from OpenStreetMap"
- click_button "Logout"
+ click_on "Logout"
assert_content "Log In"
end
visit logout_path(:referer => "/traces")
assert_content "Logout from OpenStreetMap"
- click_button "Logout"
+ click_on "Logout"
assert_content "Log In"
assert_content "Public GPS Traces"
end
sign_in_as(user)
visit user_path(other_user)
- click_link "Mute this User"
+ click_on "Mute this User"
assert_content "You muted #{other_user.display_name}"
visit edit_account_path
assert_content "Muted Users"
- click_link "Muted Users"
+ click_on "Muted Users"
assert_content "You have muted 1 User"
- click_link "Unmute"
+ click_on "Unmute"
assert_content "You unmuted #{other_user.display_name}"
refute_content "Muted Users"
fill_in "Body", :with => "some message"
assert_no_emails do
- click_button "Send"
+ click_on "Send"
end
message = Message.find_by(:sender => muted_user, :recipient => user)
test "Sign up from login page" do
visit login_path
- click_link "Register now"
+ click_on "Register now"
assert_content "Confirm Password"
end
user = build(:user)
visit root_path
- 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
- fill_in "Password", :with => "testtest"
- fill_in "Confirm Password", :with => "testtest"
- click_button "Sign Up"
+ click_on "Sign Up"
+
+ within ".new_user" do
+ fill_in "Email", :with => user.email
+ fill_in "Email Confirmation", :with => user.email
+ fill_in "Display Name", :with => user.display_name
+ fill_in "Password", :with => "testtest"
+ fill_in "Confirm Password", :with => "testtest"
+ click_on "Sign Up"
+ end
assert_content "Contributor terms"
- click_button "Cancel"
+ click_on "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_link "Unsuspend"
+ click_on "Unsuspend"
end
assert_no_content "Unsuspend"
user = create(:user, :suspended)
visit user_path(user)
accept_confirm do
- click_link "Confirm"
+ click_on "Confirm"
end
assert_no_content "Unsuspend"
visit edit_preferences_path
fill_in "Preferred Languages", :with => "fr"
- click_button "Update Preferences"
+ click_on "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_button "Login", :match => :first
+ click_on "Login", :match => :first
end
def session_for(user)