Created
October 16, 2012 16:08
-
-
Save cupakromer/3900265 to your computer and use it in GitHub Desktop.
RSpec good idea?
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 CommentsController do | |
describe '#create' do | |
context 'with valid form' do | |
let(:expect_commenting) { expect{ post :create, comment: { user_id: 1, body: "This is a comment" } } } | |
subject { | |
post :create, comment: { user_id: 1, body: "This is a comment" } | |
@controller | |
} | |
it { expect_commenting.to change{Comment.count}.by 1 } | |
it { should redirect_to comments_path } | |
it { should set_the_flash[:notice].to 'Comment Created!' } | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment