diff --git a/test/unit/journal_test.rb b/test/unit/journal_test.rb index 6333058b..71831982 100644 --- a/test/unit/journal_test.rb +++ b/test/unit/journal_test.rb @@ -115,4 +115,29 @@ class JournalTest < ActiveSupport::TestCase assert_equal "Test setting fields on Journal from Issue", @issue.last_journal.notes assert_equal @issue.author, @issue.last_journal.user end + + test "subclasses of journaled models should have journal of parent type" do + Ticket = Class.new(Issue) + + project = Project.generate! + ticket = Ticket.new do |t| + t.project = project + t.subject = "Test initial journal" + t.tracker = project.trackers.first + t.author = User.generate! + t.description = "Some content" + end + + begin + oldstdout = $stdout + $stdout = StringIO.new + ticket.save! + assert $stdout.string.empty?, "No errors should be logged to stdout." + ensure + $stdout = oldstdout + end + + journal = ticket.journals.first + assert_equal IssueJournal, journal.class + end end