Skip to content

Instantly share code, notes, and snippets.

@neilmiddleton
Created June 29, 2011 14:47
Show Gist options
  • Save neilmiddleton/1053981 to your computer and use it in GitHub Desktop.
Save neilmiddleton/1053981 to your computer and use it in GitHub Desktop.
Failing RSpec test
AboutYou.any_instance.stub!(:save).and_return(false)
post :create
assigns[:about_you].should be_new_record
flash[:notice].should be_nil
response.should render_template('new')
def create
@about_you = current_user.build_about_you(params[:about_you])
if @about_you.save
flash[:notice] = "Your details have been saved"
redirect_to cashflow_path
else
render :new
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment