0
votes

Hi I am having issues when running my specs, it seems that I cannot log in when I turn on javascript for my tests.

describe "logging in" do 
  let!(:user) { FactoryGirl.create(:user) }

  before do
     visit new_user_session_path
     fill_in "Email", with: user.email
     fill_in "Password", with: user.password
     click_link "Sign in"
  end

  it "should do something" do
    page.should have_css('.flash', text: "You have successfully signed in") 
  end
end

What is weird is that this works perfectly fine. What is weird is that when I try to turn on js by changing the first line to: describe "loggin in", js: true do, the test fails and says invalid email password combination in the flash notice.

I am using Rails 3.2.6, rspec-rails (2.11.0), and capybara-webkit (0.12.1). My spec helper has the line Capybara.javascript_driver = :webkit.

I am not sure what exactly is going on, I have used pry to check that the user is created (it is) although I am not positive how to check that the fields are being filled in correctly. I believe that they are being filled in correctly because it works when javascript is turned off.

Note, I know you don't need javascript for this test but I didn't feel like posting the actual spec. Thanks!

1

1 Answers

0
votes

Figured out you need config.action_dispatch.show_exceptions = true in your #config/environments/test.rb