Improve system tests for issues
This commit is contained in:
parent
518cf69b34
commit
29f12c4547
5 changed files with 27 additions and 14 deletions
|
@ -53,6 +53,7 @@ class IssuesTest < ApplicationSystemTestCase
|
|||
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
|
||||
|
@ -60,11 +61,13 @@ class IssuesTest < ApplicationSystemTestCase
|
|||
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
|
||||
|
||||
|
|
|
@ -25,11 +25,12 @@ class ReportDiaryCommentTest < ApplicationSystemTestCase
|
|||
|
||||
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
|
||||
|
|
|
@ -24,9 +24,13 @@ class ReportDiaryEntryTest < ApplicationSystemTestCase
|
|||
|
||||
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
|
||||
|
@ -43,7 +47,9 @@ class ReportDiaryEntryTest < ApplicationSystemTestCase
|
|||
|
||||
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?
|
||||
|
|
|
@ -20,12 +20,13 @@ class ReportNoteTest < ApplicationSystemTestCase
|
|||
|
||||
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
|
||||
|
@ -39,11 +40,12 @@ class ReportNoteTest < ApplicationSystemTestCase
|
|||
|
||||
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
|
||||
|
|
|
@ -20,11 +20,12 @@ class ReportUserTest < ApplicationSystemTestCase
|
|||
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue