3 class IssueTest < ActiveSupport::TestCase
8 issue.assigned_role = "bogus"
9 assert_not issue.valid?
12 def test_reported_user
13 create(:language, :code => "en")
15 note = create(:note_comment, :author => create(:user)).note
16 anonymous_note = create(:note_comment, :author => nil).note
17 diary_entry = create(:diary_entry)
18 diary_comment = create(:diary_comment, :diary_entry => diary_entry)
20 issue = Issue.new(:reportable => user, :assigned_role => "administrator")
22 assert_equal issue.reported_user, user
24 issue = Issue.new(:reportable => note, :assigned_role => "administrator")
26 assert_equal issue.reported_user, note.author
28 issue = Issue.new(:reportable => anonymous_note, :assigned_role => "administrator")
30 assert_nil issue.reported_user
32 issue = Issue.new(:reportable => diary_entry, :assigned_role => "administrator")
34 assert_equal issue.reported_user, diary_entry.user
36 issue = Issue.new(:reportable => diary_comment, :assigned_role => "administrator")
38 assert_equal issue.reported_user, diary_comment.user