Created
January 18, 2012 04:19
-
-
Save bicepjai/1630939 to your computer and use it in GitHub Desktop.
redirect_to rspec test error
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
class UsersController < ApplicationController | |
def new | |
@user = User.new | |
@title = "Sign up" | |
end | |
def create | |
@user = User.new(params[:user]) | |
if @user.save | |
redirect_to login_url, :notice => "Signed up!" | |
else | |
@title = "Sign up" | |
render :new | |
end | |
end | |
end | |
describe "Users" do | |
describe "signup" do | |
describe "success" do | |
it "should make a new user" do | |
lambda do | |
visit signup_path | |
fill_in "Username", :with => "foobar" | |
fill_in "Email", :with => "[email protected]" | |
fill_in "Password", :with => "foobar123" | |
fill_in "Password confirmation", :with => "foobar123" | |
click_button | |
response.should redirect_to(login_path) | |
response.should have_selector('div.flash.notice', | |
:content => "Signed up!") | |
end.should change(User, :count).by(1) | |
end | |
end | |
end | |
end | |
test fails saying | |
1) Users signup success should make a new user | |
Failure/Error: response.should redirect_to(login_path) | |
Expected response to be a <:redirect>, but was <200> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment