Empty Flash with Cucumber on Rails 2.3.6, 2,3,7, and 2.3.8 with Authlogic. #142

Open
napcs opened this Issue May 25, 2010 · 8 comments

Comments

Projects
None yet
5 participants

napcs commented May 25, 2010

This code, using Authlogic (2.1.4, 2.1.3, 2.1.1) fails a Cuke story, using Rails 2.3.5, Webrat (multiple versions) and Cucumber (multiple versions). Capybara fails too.

  def create
    @user_session = UserSession.new(params[:user_session])
    if @user_session.save
      redirect_back_or_default(dashboard_url, :notice => "Login successful!")
    else
      render :action => :new
    end
  end

(This also fails with the old style flash[:notice] version)

The step that fails is

Scenario: Successful Home page login
Given I have signed up as a user
And I am on the home page
And I fill in "Login" with "user" 
And I fill in "Password" with "password"
And I press "Log In"
Then I should see "Logged in successfully!"

Flash notice does NOT appear in the HTML dump in cuke. Flash notices appear fine in dev mode or through the browser.

Removing the call to

@user_session.save

makes the notice show up in the output.

Another developer on a completely unrelated project has the same issue. No idea of the cause yet though. New apps without Authlogic work appropriately so that's the only reason we're thinking there's a problem here.

Your thoughts are appreciated.

leondu commented May 26, 2010

same happens here.

graaff commented May 26, 2010

I see this happening in our application as well.

Contributor

bcardarella commented May 26, 2010

It seems to be an issue when Authlogic touches the sessions hash. This only happens when redirects happen and the flash is embedded in the session.
Confirmed that this is not a Webrat issue.
Confirmed that this is not a Rails Integration test issue.

@ghost

ghost commented May 26, 2010

This is strange. Especially when everything was working fine before the new rails release. More importantly, authlogic isn't doing anything crazy with the session, its just storing a persistence token in it. Gotta love the rails "minor" releases.

napcs commented May 26, 2010

Keep in mind it's only happening with integration-based tests. This works fine in dev, prod, and even with rspec.

Contributor

bcardarella commented May 28, 2010

I've confirmed that this is not a rack-test issue

graaff commented Jun 4, 2010

I've succesfully applied to patch by Jesse Storimer at the end of https://rails.lighthouseapp.com/projects/8994/tickets/4743-session-cookie-breaks-if-used-with-custom-cookie-in-rails-238 to fix this.

graywh commented Jun 29, 2010

The fix suggested on that ticket works for me, too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment