3 class IssueTest < ActiveSupport::TestCase
7 assert_predicate issue, :valid?
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 = build(:issue, :reportable => user, :assigned_role => "administrator")
22 assert_equal issue.reported_user, user
24 issue = build(:issue, :reportable => note, :assigned_role => "administrator")
26 assert_equal issue.reported_user, note.author
28 issue = build(:issue, :reportable => anonymous_note, :assigned_role => "administrator")
30 assert_nil issue.reported_user
32 issue = build(:issue, :reportable => diary_entry, :assigned_role => "administrator")
34 assert_equal issue.reported_user, diary_entry.user
36 issue = build(:issue, :reportable => diary_comment, :assigned_role => "administrator")
38 assert_equal issue.reported_user, diary_comment.user