Created
March 20, 2011 12:45
-
-
Save oelmekki/878311 to your computer and use it in GitHub Desktop.
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
describe 'with valid attributes' do | |
describe 'when publishing' do | |
before :each do | |
post 'create', :blog_post => @valid_attributes, :commit => { :publish => 'publish' } | |
end | |
it 'should create a new blog post' do | |
BlogPost.count.should == 1 | |
end | |
it 'should publish it' do | |
BlogPost.first.published.should be_true | |
end | |
it 'should redirect to blog post page' do | |
response.should redirect_to( blog_post_path( BlogPost.first ) ) | |
end | |
end | |
end | |
describe 'with invalid attributes' do | |
before :each do | |
post 'create', :blog_post => @valid_attributes.merge( :content => nil ), :commit => { :publish => 'publish' } | |
end | |
it 'should not create new blog post' do | |
BlogPost.count.should == 0 | |
end | |
it 'should render new template' do | |
response.should render_template( :new ) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment