0
votes

Capybara is acting really strange.

It wasn't finding any input fields at all, ID, name or label. So I changed the test to just check what was rendering and get a huge sass error.

feature "new users are not admin" do
    scenario "user signs up" do
        visit new_user_registration_path

    #fill_in "Username", :with => "newuser"
    #fill_in "Email", with: "[email protected]"
    #fill_in "Password", with: "newuserpassword"
    #fill_in "Password Confirmation", with: "newuserpassword"


    #click_button "Sign up"

    expect(page).to have_content("Sign Up")
 end
end

And then this:

Failure/Error: expect(page).to have_content("Sign Up")
           expected to find text "Sign Up" in "Sass::SyntaxError at /users/sign_up =================================== > Invalid CSS after \"\": expected selector, was \"===============...\" (in app/assets/stylesheets/application.css) app/views/layouts/application.html.erb, line 5 ---------------------------------------------- ``` ruby 1 2 3 4 > 5 true %> 6 true %> 7 8 9 10 ```

Which is actually a lot more, and seems to be the contents of the error page rails produces (better_errors), but only in tests, not when visiting the actual application. This is also only when the fill_in/click_button is commented out, otherwise it will be "could not find field 'username' etc.

The sass error has "============" in it which is part of how I split my css in sections with a large comment block e.g.

/*=============
Styles
==============*/

But this is all commented out. I don't see what it would cause a problem.

I have no idea what's going on. Any help is appreciated.

1

1 Answers

0
votes

Fixed this, it was, for some reason, an un-commented section in bootstrap.css (that for some reason doesn't render an error except via tests).

Works as intended now