]> git.openstreetmap.org Git - rails.git/blobdiff - test/models/note_test.rb
Added unit tests for new Note methods
[rails.git] / test / models / note_test.rb
index 34b16c19d5e113a197ee4ff8ba7b4b29ff600256..ba87911e33a8d79be67e2793958bdb5f8c20290b 100644 (file)
@@ -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