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

Trying to get this example working from http://www.munna.shatkotha.com/blog/post/2008/10/26/Light-box-effect-with-WPF.aspx However, I can't seem to get
Alright, I'm trying to get arguments to work properly with a small test application.
I'm trying get values from a GridView using the following code: foreach (GridViewRow row
Trying to get an ASP application deployed; it worked for a while but then
Whilst trying to get our app working in Firefox (I'm a big proponent of
Im trying to get into some basic JavaFX game development and I'm getting confused
Using TeamCity, I'm trying to get a (TestAutomationFX) test that requires an STA thread
I'm trying to get rid of everything before the filename ex: /home/mike/whatever/test_1.txt leaving only
I'm trying to see if there's a way to get a consistent unit test
Trying to get my css / C# functions to look like this: body {

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.