test "flash message should not contain raw html" do
visit user_confirm_resend_path(@user)
- assert page.has_content?("sent a new confirmation")
- assert_not page.has_content?("<p>")
+ assert_content "sent a new confirmation"
+ assert_no_content "<p>"
end
end
click_on "Send a message to the author"
- assert page.has_content? "Send a new message"
+ assert_content "Send a new message"
assert_equal "Re: #{@diary_entry.title}", page.find_field("Subject").value
end
sign_in_as(create(:user))
visit diary_entries_path
- assert_not page.has_content? @deleted_entry.title
+ assert_no_content @deleted_entry.title
end
test "deleted diary entries should be shown to administrators for review" do
sign_in_as(create(:administrator_user))
visit diary_entries_path
- assert page.has_content? @deleted_entry.title
+ assert_content @deleted_entry.title
end
test "deleted diary entries should not be shown to admins when the user is also deleted" do
sign_in_as(create(:administrator_user))
visit diary_entries_path
- assert_not page.has_content? @deleted_entry.title
+ assert_no_content @deleted_entry.title
end
test "deleted diary comments should be hidden for regular users" do
sign_in_as(create(:user))
visit diary_entry_path(@diary_entry.user, @diary_entry)
- assert_not page.has_content? @deleted_comment.body
+ assert_no_content @deleted_comment.body
end
test "deleted diary comments should be shown to administrators" do
sign_in_as(create(:administrator_user))
visit diary_entry_path(@diary_entry.user, @diary_entry)
- assert page.has_content? @deleted_comment.body
+ assert_content @deleted_comment.body
end
end
def test_view_issues_not_logged_in
visit issues_path
- assert page.has_content?(I18n.t("sessions.new.title"))
+ assert_content I18n.t("sessions.new.title")
end
def test_view_issues_normal_user
sign_in_as(create(:user))
visit issues_path
- assert page.has_content?("Forbidden")
+ assert_content "Forbidden"
end
def test_view_no_issues
sign_in_as(create(:moderator_user))
visit issues_path
- assert page.has_content?(I18n.t("issues.index.issues_not_found"))
+ assert_content I18n.t("issues.index.issues_not_found")
end
def test_view_issues
issues = create_list(:issue, 3, :assigned_role => "moderator")
visit issues_path
- assert page.has_content?(issues.first.reported_user.display_name)
+ assert_content issues.first.reported_user.display_name
end
def test_view_issues_with_no_reported_user
issue = create(:issue, :reportable => anonymous_note, :assigned_role => "moderator")
visit issues_path
- assert page.has_content?(reportable_title(anonymous_note))
+ assert_content reportable_title(anonymous_note)
visit issue_path(issue)
- assert page.has_content?(reportable_title(anonymous_note))
+ assert_content reportable_title(anonymous_note)
end
def test_search_issues_by_user
visit issues_path
fill_in "search_by_user", :with => good_user.display_name
click_on "Search"
- assert_not page.has_content?(I18n.t("issues.index.user_not_found"))
- assert page.has_content?(I18n.t("issues.index.issues_not_found"))
+ 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"
- assert page.has_content?(I18n.t("issues.index.user_not_found"))
- assert page.has_content?(I18n.t("issues.index.issues_not_found"))
+ 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"
- assert_not page.has_content?(I18n.t("issues.index.user_not_found"))
- assert_not page.has_content?(I18n.t("issues.index.issues_not_found"))
+ assert_no_content I18n.t("issues.index.user_not_found")
+ assert_no_content I18n.t("issues.index.issues_not_found")
end
def test_commenting
fill_in :issue_comment_body, :with => "test comment"
click_on "Add Comment"
- assert page.has_content?(I18n.t("issue_comments.create.comment_created"))
- assert page.has_content?("test comment")
+ assert_content I18n.t("issue_comments.create.comment_created")
+ assert_content "test comment"
issue.reload
assert_equal("test comment", issue.comments.first.body)
visit edit_preferences_path
click_on "Update Preferences"
- assert page.has_content?("Preferences updated")
+ assert_content "Preferences updated"
end
def test_flash_message_shows_in_new_language
fill_in "Preferred Languages", :with => "fr"
click_on "Update Preferences"
- assert page.has_content?("Préférences mises à jour")
+ assert_content "Préférences mises à jour"
end
end
def test_no_link_when_not_logged_in
visit diary_entry_path(@diary_entry.user.display_name, @diary_entry)
- assert page.has_content?(@comment.body)
+ assert_content @comment.body
- assert_not page.has_content?(I18n.t("diary_entries.diary_comment.report"))
+ assert_no_content I18n.t("diary_entries.diary_comment.report")
end
def test_it_works
sign_in_as(create(:user))
visit diary_entry_path(@diary_entry.user.display_name, @diary_entry)
- assert page.has_content? @diary_entry.title
+ assert_content @diary_entry.title
click_on I18n.t("diary_entries.diary_comment.report")
- assert page.has_content? "Report"
- assert page.has_content? I18n.t("reports.new.disclaimer.intro")
+ 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"
click_on "Create Report"
end
- assert page.has_content? "Your report has been registered successfully"
+ assert_content "Your report has been registered successfully"
assert_equal @comment, Issue.last.reportable
assert_equal "administrator", Issue.last.assigned_role
def test_no_link_when_not_logged_in
visit diary_entry_path(@diary_entry.user.display_name, @diary_entry)
- assert page.has_content?(@diary_entry.title)
+ assert_content @diary_entry.title
- assert_not page.has_content?(I18n.t("diary_entries.diary_entry.report"))
+ assert_no_content I18n.t("diary_entries.diary_entry.report")
end
def test_it_works
sign_in_as(create(:user))
visit diary_entry_path(@diary_entry.user.display_name, @diary_entry)
- assert page.has_content? @diary_entry.title
+ assert_content @diary_entry.title
click_on I18n.t("diary_entries.diary_entry.report")
- assert page.has_content? "Report"
- assert page.has_content? I18n.t("reports.new.disclaimer.intro")
+ 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"
click_on "Create Report"
end
- assert page.has_content? "Your report has been registered successfully"
+ assert_content "Your report has been registered successfully"
assert_equal @diary_entry, Issue.last.reportable
assert_equal "administrator", Issue.last.assigned_role
sign_in_as(create(:user))
visit diary_entry_path(@diary_entry.user.display_name, @diary_entry)
- assert page.has_content? @diary_entry.title
+ assert_content @diary_entry.title
click_on I18n.t("diary_entries.diary_entry.report")
- assert page.has_content? "Report"
- assert page.has_content? I18n.t("reports.new.disclaimer.intro")
+ 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"
def test_missing_report_params
sign_in_as(create(:user))
visit new_report_path
- assert page.has_content? I18n.t("reports.new.missing_params")
+ assert_content I18n.t("reports.new.missing_params")
end
end
def test_no_link_when_not_logged_in
note = create(:note_with_comments)
visit browse_note_path(note)
- assert page.has_content?(note.comments.first.body)
+ assert_content note.comments.first.body
- assert_not page.has_content?(I18n.t("browse.note.report"))
+ assert_no_content I18n.t("browse.note.report")
end
def test_can_report_anonymous_notes
visit browse_note_path(note)
click_on I18n.t("browse.note.report")
- assert page.has_content? "Report"
- assert page.has_content? I18n.t("reports.new.disclaimer.intro")
+ 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"
click_on "Create Report"
end
- assert page.has_content? "Your report has been registered successfully"
+ assert_content "Your report has been registered successfully"
assert_equal note, Issue.last.reportable
assert_equal "moderator", Issue.last.assigned_role
visit browse_note_path(note)
click_on I18n.t("browse.note.report")
- assert page.has_content? "Report"
- assert page.has_content? I18n.t("reports.new.disclaimer.intro")
+ 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"
click_on "Create Report"
end
- assert page.has_content? "Your report has been registered successfully"
+ assert_content "Your report has been registered successfully"
assert_equal note, Issue.last.reportable
assert_equal "moderator", Issue.last.assigned_role
def test_no_link_when_not_logged_in
note = create(:note_with_comments)
visit browse_note_path(note)
- assert page.has_content?(note.comments.first.body)
+ assert_content note.comments.first.body
- assert_not page.has_content?(I18n.t("users.show.report"))
+ assert_no_content I18n.t("users.show.report")
end
def test_can_report_user
visit user_path(user)
click_on I18n.t("users.show.report")
- assert page.has_content? "Report"
- assert page.has_content? I18n.t("reports.new.disclaimer.intro")
+ 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"
click_on "Create Report"
end
- assert page.has_content? "Your report has been registered successfully"
+ assert_content "Your report has been registered successfully"
assert_equal user, Issue.last.reportable
assert_equal "moderator", Issue.last.assigned_role
visit user_path(user)
click_on I18n.t("users.show.report")
- assert page.has_content? "Report"
- assert page.has_content? I18n.t("reports.new.disclaimer.intro")
+ 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"
click_on "Create Report"
end
- assert page.has_content? "Your report has been registered successfully"
+ assert_content "Your report has been registered successfully"
assert_equal user, Issue.last.reportable
assert_equal "moderator", Issue.last.assigned_role
visit user_path(user)
click_on I18n.t("users.show.report")
- assert page.has_content? "Report"
- assert page.has_content? I18n.t("reports.new.disclaimer.intro")
+ 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"
click_on "Create Report"
end
- assert page.has_content? "Your report has been registered successfully"
+ assert_content "Your report has been registered successfully"
assert_equal user, Issue.last.reportable
assert_equal "administrator", Issue.last.assigned_role
test "Sign out via link" do
user = create(:user)
sign_in_as(user)
- assert_not page.has_content? "Log In"
+ assert_no_content "Log In"
click_on user.display_name
click_on "Log Out"
- assert page.has_content? "Log In"
+ assert_content "Log In"
end
test "Sign out via link with referer" do
user = create(:user)
sign_in_as(user)
visit traces_path
- assert_not page.has_content? "Log In"
+ assert_no_content "Log In"
click_on user.display_name
click_on "Log Out"
- assert page.has_content? "Log In"
- assert page.has_content? "Public GPS Traces"
+ assert_content "Log In"
+ assert_content "Public GPS Traces"
end
test "Sign out via fallback page" do
sign_in_as(create(:user))
- assert_not page.has_content? "Log In"
+ assert_no_content "Log In"
visit logout_path
- assert page.has_content? "Logout from OpenStreetMap"
+ assert_content "Logout from OpenStreetMap"
click_button "Logout"
- assert page.has_content? "Log In"
+ assert_content "Log In"
end
test "Sign out via fallback page with referer" do
sign_in_as(create(:user))
- assert_not page.has_content? "Log In"
+ assert_no_content "Log In"
visit logout_path(:referer => "/traces")
- assert page.has_content? "Logout from OpenStreetMap"
+ assert_content "Logout from OpenStreetMap"
click_button "Logout"
- assert page.has_content? "Log In"
- assert page.has_content? "Public GPS Traces"
+ assert_content "Log In"
+ assert_content "Public GPS Traces"
end
end
click_on "Register now"
- assert page.has_content? "Confirm Password"
+ assert_content "Confirm Password"
end
end