Skip to content

Commit

Permalink
Tests for validations on Post
Browse files Browse the repository at this point in the history
  • Loading branch information
jm committed Feb 5, 2010
1 parent 4730cd4 commit 930e886
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/unit/post_test.rb
Expand Up @@ -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.