skaz
skaz

Reputation: 22620

Rails Session Incorrect?

I am using capybara for an integration test and it looks like something is wrong with the session that gets passed to my controller for my "sign in" part of a test. The sign in works fine when going through a browser, but is failing in capybara.

def integration_sign_in(user)
            visit signin_path

            puts "Pre email: " + user.email
            puts "Pre password: "  + user.password

            # When I use these, everything works correctly
            fill_in "session_email", :with => user.email
            fill_in "session_password", :with => user.password 

            # When I use these, the session is wrong
            # The params[:session][:email] on the server has the password field
            # The params[:session][:password] on the server is nil
            #fill_in :email,    :with => user.email
            #fill_in :password, :with => user.password

            click_button "Sign in"
        end

Can I not use symbols for the capybara tests? My guess is that the first field (email) is being filled in for both fields in the failing case, which is why the session only has a value for email and that value is password.

Upvotes: 1

Views: 113

Answers (1)

skaz
skaz

Reputation: 22620

It looks like the latest version of capybara doesn't accept symbols correctly. It only works when the full string of the field is entered.

Upvotes: 1

Related Questions