Added unit tests for new Note methods
Added unit tests for new Note methods and updated system tests to use description instead of first comment's body.
This commit is contained in:
parent
2c19c2143e
commit
11e0444f36
3 changed files with 20 additions and 2 deletions
|
@ -47,6 +47,15 @@ class NoteTest < ActiveSupport::TestCase
|
|||
assert_not_predicate create(:note, :status => "open", :closed_at => nil), :closed?
|
||||
end
|
||||
|
||||
def test_description
|
||||
comment = create(:note_comment)
|
||||
assert_equal comment.body, comment.note.description
|
||||
|
||||
user = create(:user)
|
||||
comment = create(:note_comment, :author => user)
|
||||
assert_equal comment.body, comment.note.description
|
||||
end
|
||||
|
||||
def test_author
|
||||
comment = create(:note_comment)
|
||||
assert_nil comment.note.author
|
||||
|
@ -56,6 +65,15 @@ class NoteTest < ActiveSupport::TestCase
|
|||
assert_equal user, comment.note.author
|
||||
end
|
||||
|
||||
def test_author_id
|
||||
comment = create(:note_comment)
|
||||
assert_nil comment.note.author_id
|
||||
|
||||
user = create(:user)
|
||||
comment = create(:note_comment, :author => user)
|
||||
assert_equal user.id, comment.note.author_id
|
||||
end
|
||||
|
||||
def test_author_ip
|
||||
comment = create(:note_comment)
|
||||
assert_nil comment.note.author_ip
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue