diff --git a/app/models/comment.rb b/app/models/comment.rb index 92cf2e2..21ca41e 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -204,4 +204,9 @@ class Comment < ActiveRecord::Base self.save! end + def ham! + self.spam = false + self.save! + end + end diff --git a/test/unit/comment_test.rb b/test/unit/comment_test.rb index 4c6c2bb..7eb2d85 100644 --- a/test/unit/comment_test.rb +++ b/test/unit/comment_test.rb @@ -460,4 +460,11 @@ class CommentTest < ActiveSupport::TestCase assert_equivalent [c3], Comment.spam end + should 'be able to mark as ham atomically' do + c1 = fast_create(Comment, :name => 'foo', :email => 'foo@example.com', :spam => true) + c1.ham! + c1.reload + assert c1.ham? + end + end -- libgit2 0.21.2