Assert_redirected_to not working as expected

I’ve installed the “acts_as_authenticated” plugin and made some
modifications to the controller (app/controllers/account_controller.rb)
“signup” module as follows:

===
def signup
@page_title = ‘Create Account’
@user = User.new(@params[:user])
if request.post?
if @user.save
session[:user] = User.authenticate(@user.login, @user.password)
redirect_to(:controller => ‘/home’, :action => ‘welcome’)
else
flash[:notice] = “Signup unsuccessful!”
end
end
end

The “success” integration test
(test/integration/authentication_test.rb) looks like this (snipped):

===
class AuthenticationTest < ActionController::IntegrationTest
def setup
User.create(:login => “goober”,
:email => “[email protected]”,
:password => “gomer”,
:password_confirmation => “gomer”)
end

def test_successful_signup
gooddog = enter_site(:gooddog)
gooddog.signs_up_successfully
end

private

module BrowsingTestDSL
include ERB::Util
attr_writer :name

def signs_up_successfully
  post_signup("gooddog", "[email protected]", "gooddog",

“gooddog”)
assert_redirected_to :controller => “home”, :action => “welcome”
end

private

def post_signup(login, email, password, confirm_password)
  post "/account/signup", :login => login, :email => email,

:password => password, :confirm_password => confirm_password
end

end

def enter_site(name)
open_session do |session|
session.extend(BrowsingTestDSL)
session.name = name
yield session if block_given?
end
end
end

===

I’m on Windows and am running the test using this command:

ruby test/integration/authentication_test.rb - n test_successful_signup

Resulting in:

“Expected response to be a <:redirect>, but was <200>”

Running live produces the desired behavior, i.e., a new user is
created, data stored in the database, and the user is redirected to a
Welcome page.

Is there something(s) about the test environment that I’ve missed?

Thanks,
Stan

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs