[#708] Adding tests exposing the erroneous behavior
This commit is contained in:
parent
e2938d26f3
commit
fb7f109ac6
@ -115,4 +115,29 @@ class JournalTest < ActiveSupport::TestCase
|
|||||||
assert_equal "Test setting fields on Journal from Issue", @issue.last_journal.notes
|
assert_equal "Test setting fields on Journal from Issue", @issue.last_journal.notes
|
||||||
assert_equal @issue.author, @issue.last_journal.user
|
assert_equal @issue.author, @issue.last_journal.user
|
||||||
end
|
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
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user