views:

136

answers:

1

I am running rails 3.0.0, rspec-rails 2.0.0.beta.20, webrat 0.7.2.beta.1, cucumber-rails 0.3.2 I have this scenario:

Scenario:
  Given I am on the new account page
  And I fill in "Name" with "John Doe"
  When I press "Create"
  Then I should be on the access page

When I run it I get:

expected: "/access",
got: "/accounts"

Like its not following the redirect_to in the controller:

#accounts_controller.rb
def create
  @account = Account.new(params[:account])
  if @account.save
    flash[:notice] = "Saved!"
    redirect_to access_url  
  else
    flash[:alert] = "Error!"
    render :new
  end
end

Am I missing a step? I thought webrat followed all redirects. Thanks

Using launchy gem I get a page that says:

"You are being redirected" with a link to the access_path

?

+1  A: 

Not sure if this applies in Rails 3, but can you just try this method "follow_redirect!"

Rishav Rastogi