[#708] Adding tests exposing the erroneous behavior

This commit is contained in:
Gregor Schmidt 2011-11-17 10:36:44 +01:00
parent e2938d26f3
commit fb7f109ac6
1 changed files with 25 additions and 0 deletions

View File

@ -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