3 class IssueTest < ActiveSupport::TestCase
5 note = create(:note_comment, :author => create(:user)).note
7 create(:language, :code => "en")
8 diary_entry = create(:diary_entry)
11 issue.reportable = user
13 assert_equal issue.reported_user, user
15 # FIXME: doesn't handle anonymous notes
16 issue.reportable = note
18 assert_equal issue.reported_user, note.author
20 issue.reportable = diary_entry
22 assert_equal issue.reported_user, diary_entry.user
25 def test_default_assigned_role
26 create(:language, :code => "en")
27 diary_entry = create(:diary_entry)
28 note = create(:note_with_comments)
31 issue.reportable = diary_entry
33 assert_equal "administrator", issue.assigned_role
36 issue.reportable = note
38 assert_equal "moderator", issue.assigned_role
40 # check the callback doesn't override an explicitly set role
41 issue.assigned_role = "administrator"
44 assert_equal "administrator", issue.assigned_role