Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4343686
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T11:47:20+00:00 2026-05-21T11:47:20+00:00

I am trying to get tests working after switching from Webrat to Capybara. When

  • 0

I am trying to get tests working after switching from Webrat to Capybara. When I try to sign in to the application I am getting a “Invalid username/password” error, despite just having created the user in a Factory using factory_girl. The way I understand it, the user should persist for the entirety of the fixture, right?

factories.rb:

Factory.define :user do |user|
  user.firstname             "Test"
  user.lastname              "Test" 
  user.email                 "test@test.com"
  user.password              "testtest"
  user.password_confirmation "testtest"
end

layout_links.spec.rb:

describe "LayoutLinks" do
    before(:each) do
        wrong_user = Factory(:user)
        integration_sign_in(wrong_user)
    end

    it "should have a dashboard page" do
        get '/dashboard'
        page.should have_css('h1', :text => "Navigation#dashboard")

    end

spec_helper.rb

def integration_sign_in(user)
            visit signin_path
            fill_in :email,    :with => user.email
            fill_in :password, :with => user.password
            click_button "Sign in"
            puts page.body
        end

Also in spec_helper.rb is the following:

config.use_transactional_fixtures = false

    config.before(:suite) do
        DatabaseCleaner.strategy = :truncation
    end

    config.before(:each) do
        DatabaseCleaner.start
    end

    config.after(:each) do
        DatabaseCleaner.clean
    end

Shouldn’t the user persist and then be successful in the integration_sign_in function? I can still sign in correctly through the browser in the development environment, which has a user and the sign in was working correctly with webrat before the migration, so I am not sure what to think. Thanks!

UPDATE: It looks like the session isn’t going to the server correctly. On the server, when I check the value of email and password in the session, the values are incorrect:

puts "Post Email: " + params[:session][:email]
puts "Post Password: " + params[:session][:password]

the email variable has the password variable, and the password variable has no value. Why would this be? The client integration test maps the fields correctly:

fill_in :email,    :with => user.email
fill_in :password, :with => user.password

How can I test this further? Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T11:47:21+00:00Added an answer on May 21, 2026 at 11:47 am

    So this worked for me

    fill_in "Email", :with => user.email
    fill_in "Password", :with => user.password
    

    whereas using the symbols failed

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm just trying to get admob running and tested different working code examples from
I am trying to get a ASP.NET Unit Test running and I keep getting
I've trying to get some vertical text on a little test webpage after reading
I am trying to test a sinatra app using minitest and capybara but get
Trying to get a working directfb for use in an embedded system based on
I'm trying to get an autocomplete form working, and I can't seem to figure
I've been trying to get wicket and guice working together, more specifically injecting a
I'm trying to get back into rails after a while and am having a
I am trying to get started with working with named pipes as I will
I'm trying to set up some unit tests for an XNA project. After some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.