Add more tests
This commit is contained in:
parent
ab3150646c
commit
46c183ffeb
7 changed files with 121 additions and 4 deletions
35
test/system/report_diary_comment_test.rb
Normal file
35
test/system/report_diary_comment_test.rb
Normal file
|
@ -0,0 +1,35 @@
|
|||
require "application_system_test_case"
|
||||
|
||||
class ReportDiaryCommentTest < ApplicationSystemTestCase
|
||||
def setup
|
||||
create(:language, :code => "en")
|
||||
@diary_entry = create(:diary_entry)
|
||||
@comment = create(:diary_comment, :diary_entry => @diary_entry)
|
||||
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 !page.has_content?(I18n.t("diary_entry.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
|
||||
|
||||
click_on I18n.t("diary_entry.diary_comment.report")
|
||||
assert page.has_content? "Report"
|
||||
assert page.has_content? I18n.t("issues.new.disclaimer.intro")
|
||||
|
||||
choose I18n.t("reports.categories.diary_comment.spam")
|
||||
fill_in "report_details", :with => "This comment is spam"
|
||||
click_on "Create Report"
|
||||
|
||||
assert page.has_content? "Your report has been registered sucessfully"
|
||||
|
||||
assert_equal 1, Issue.count
|
||||
assert Issue.last.reportable == @comment
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue