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"))
# User doesn't exist
fill_in "search_by_user", :with => "Nonexistant 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"))
# 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"))
end
choose I18n.t("reports.new.categories.diary_comment.spam")
fill_in "report_details", :with => "This comment is spam"
- click_on "Create Report"
+ assert_difference "Issue.count", 1 do
+ click_on "Create Report"
+ end
assert page.has_content? "Your report has been registered sucessfully"
- assert_equal 1, Issue.count
- assert Issue.last.reportable == @comment
+ assert_equal @comment, Issue.last.reportable
end
end
choose I18n.t("reports.new.categories.diary_entry.spam")
fill_in "report_details", :with => "This is advertising"
- click_on "Create Report"
+ assert_difference "Issue.count", 1 do
+ click_on "Create Report"
+ end
assert page.has_content? "Your report has been registered sucessfully"
+
+ assert_equal @diary_entry, Issue.last.reportable
end
def test_it_reopens_issue
choose I18n.t("reports.new.categories.diary_entry.spam")
fill_in "report_details", :with => "This is advertising"
- click_on "Create Report"
+ assert_no_difference "Issue.count" do
+ click_on "Create Report"
+ end
issue.reload
assert_not issue.resolved?
choose I18n.t("reports.new.categories.note.spam")
fill_in "report_details", :with => "This is spam"
- click_on "Create Report"
+ assert_difference "Issue.count", 1 do
+ click_on "Create Report"
+ end
assert page.has_content? "Your report has been registered sucessfully"
- assert_equal 1, Issue.count
- assert Issue.last.reportable == note
+ assert_equal note, Issue.last.reportable
end
def test_can_report_notes_with_author
choose I18n.t("reports.new.categories.note.spam")
fill_in "report_details", :with => "This is spam"
- click_on "Create Report"
+ assert_difference "Issue.count", 1 do
+ click_on "Create Report"
+ end
assert page.has_content? "Your report has been registered sucessfully"
- assert_equal 1, Issue.count
- assert Issue.last.reportable == note
+ assert_equal note, Issue.last.reportable
end
end
choose I18n.t("reports.new.categories.user.vandal")
fill_in "report_details", :with => "This user is a vandal"
- click_on "Create Report"
+ assert_difference "Issue.count", 1 do
+ click_on "Create Report"
+ end
assert page.has_content? "Your report has been registered sucessfully"
- assert_equal 1, Issue.count
- assert Issue.last.reportable == user
+ assert_equal user, Issue.last.reportable
end
end