Permalink
Browse files

Tests for validations on Post

  • Loading branch information...
jm committed Feb 5, 2010
1 parent 4730cd4 commit 930e8868b0e4d8904d6f5090f6b445b0c428f71f
Showing with 12 additions and 0 deletions.
  1. +12 −0 test/unit/post_test.rb
@@ -6,4 +6,16 @@ class PostTest < ActiveSupport::TestCase
assert_equal "<p>Now <em>this</em> is an awesome post.</p>", post.rendered_body.chomp
end
test "requires title" do
post = Post.create(:body => "Now *this* is an awesome post.")
assert !post.valid?
assert post.errors[:title]
end
test "requires body" do
post = Post.create(:title => "This post rocks.")
assert !post.valid?
assert post.errors[:body]
end
end

0 comments on commit 930e886

Please sign in to comment.