-
Notifications
You must be signed in to change notification settings - Fork 436
Description
Hey there -- it doesn't seem that this issue has been raised yet, and I don't even know if this issue is necessarily the fault of this gem, but I'm opening this in the hopes that I can get some pointers.
It seems that adding better_errors is interfering with Capybara feature tests, even when it's added only to the development group.
Here's what I did:
-
Made a simple vanilla Rails app (4.2.1)
-
Added rspec-rails (3.2.1)
-
Ran
rails g rspec:install -
Added the following to config/routes.rb:
get /users, to: "users#index" -
Added the following test to spec/features/my_feature_spec.rb
require 'rails_helper' feature 'My feature' do scenario 'is awesome' do visit '/users' expect(page).to have_content('Users') end end
-
Ran the test. As expected, it fails with:
ActionController::RoutingError: uninitialized constant UsersController -
Then, I added better_errors to the Gemfile, but only in the development group
-
Ran the test again. Now it passes! How? Well, if you throw in a
save_and_open_pagethen you'll get the text version of better_errors:ActionController::RoutingError at /users ======================================== > uninitialized constant UsersController spec/features/my_feature_spec.rb, line 5 ---------------------------------------- ``` ruby 1 require 'rails_helper' 2 3 feature 'My feature' do 4 scenario 'is awesome' do > 5 visit '/users' 6 expect(page).to have_content('Users') 7 save_and_open_page 8 end 9 end ... etc., etc. ...I realize this may be "expected" behavior, but my question is, why is this happening?