Last active
August 29, 2015 13:57
-
-
Save ilstar/9864334 to your computer and use it in GitHub Desktop.
Rspec Rails cheat sheet
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
# version | |
# gem 'rspec-rails', '~> 2.14.2' | |
# render and redirect | |
response.should be_success | |
response.status.should == 404 | |
response.response_code.should == 404 | |
response.should render_template('index') | |
response.should redirect_to(movies_path) | |
# template | |
response.body.should =~ /welcome to rails world/m | |
# variables | |
assigns(:players).should be_empty | |
assigns(:players).should_not be_empty | |
# stub | |
Player.any_instance.stub(:save).and_return(false) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment