Created
December 19, 2010 22:25
-
-
Save tubbo/747760 to your computer and use it in GitHub Desktop.
RSpec tests for Post
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe Post do | |
context "A post (in general)" do | |
setup do | |
@post=Post.new({ | |
:id => 1, | |
:created_at => Time.now | |
}) | |
end | |
it "should be invalid without a title" do | |
@post.should_not_be_valid | |
@post.title='A title!' | |
@post.should_be_valid | |
end | |
it 'should be invalid without a body' do | |
@post.should_not_be_valid | |
@post.body='A body!' | |
@post.should_be_valid | |
end | |
# specify "should be invalid without a title" do | |
# @post.should_not_be_valid | |
# @post.title='A title!' | |
# @post.should_be_valid | |
# end | |
# | |
# specify "should be invalid without a body" do | |
# @post.title='A title!' | |
# @post.should_not_be_valid | |
# @post.body='A body!' | |
# @post.should_be_valid | |
# end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment