BetterErrors / BetterErrors/better_errors

Interferes with Capybara tests even when only added to dev group

Open
#304 8 comments 0 reactions 0 assignees View on GitHub
documentation
Dominant language
Ruby
Stars
6.9k
Forks
430
PR merge metrics
No merged PRs in 30d

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

``` ruby
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_page` then 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?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.