X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/dbd88d893f3c3fce9cafd666b94396988646d81f..e31376e28da8f656e33508cc899da465b63673c5:/test/models/issue_test.rb diff --git a/test/models/issue_test.rb b/test/models/issue_test.rb index 7e15ee90c..7ee700124 100644 --- a/test/models/issue_test.rb +++ b/test/models/issue_test.rb @@ -1,7 +1,24 @@ require "test_helper" class IssueTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end + def test_reported_user + note = create(:note_comment, :author => create(:user)).note + user = create(:user) + create(:language, :code => "en") + diary_entry = create(:diary_entry) + issue = Issue.new + + issue.reportable = user + issue.save! + assert_equal issue.reported_user, user + + # FIXME: doesn't handle anonymous notes + issue.reportable = note + issue.save! + assert_equal issue.reported_user, note.author + + issue.reportable = diary_entry + issue.save! + assert_equal issue.reported_user, diary_entry.user + end end