view helper availability regression in 0.1.1
lnhrdt opened this issue · 9 comments
Using version 0.1.1 with this directory structure:
app
├── helpers
│ └── jobs_helper.rb
└── views
└── jobs
├── _job.html.haml
└── table
└── _row.html.haml
during tests _job.html.haml
can reference helpers in jobs_helper.rb
but _row.html.haml
cannot. Both views could reference the helpers using rails-controller-testing 0.1.0.
Both views can reference the helpers in the application outside of tests.
Using rails 5.0.0.beta3.
If a sample would be helpful, the following demonstrates the problem:
https://github.com/aphelion/mcc/tree/f8c4db2a5b2f4dc175fdf81293bab0c4e1fd815c
The Gemfile.lock has rails-controller-testing 0.1.0 but if upgraded to 0.1.1 tests fail.
Hi @lennyk!
Please provide the steps to reproduce the error you're seeing. Thanks! :)
Sure!
git clone git@github.com:aphelion/mcc.git
cd mcc
git checkout f8c4db2
bundle install
rspec
95 examples, 0 failures
😄 (rails-controller-testing 0.1.0)
bundle update
This should have upgraded rails-controller-testing to 0.1.1
rspec
95 examples, 9 failures
😢 (rails-controller-testing 0.1.1)
I have some further detail to this, based on checking RSpec's build for 5.0.0.beta3. With the current commit on master, while running our build, I get the following backtrace:
https://gist.github.com/samphippen/2745cbfa8da9c82631ab
using 3d81f3d there was no backtrace of this from in our build (which failed for other reasons, something that changed in an actionmailer railtie).
Let me know if you'd need any more details from the RSpec end.
This was caused by ce370fe moving that load hook into on_load(:action_view)
. The issue is that AbstractController::Rendering
actually requires files from ActionView
, causing that hook to get run before that constant is defined (and ActionView::TestCase
, references ActionController::Base
somewhere).
Unsure what the correct fix is, just wanted to report the result of a few minutes of digging.
Also worth noting, I see a giant dump of output that looks to be from the same issue (but not an error) when running the test suite with rake 11, but not with rake 10.5.0, which is what the last travis run used
The error in RSpec occurs regardless of Rake version
This replicates the error and causes the test suite to fail:
echo "AbstractController::Rendering" > test/dummy/config/initializers/hi.rb
Fixed by rails/rails@12cce89
In case anyone needs to work around this issue until the next Rails release, look through your initializers for something referencing AbstractController::Rendering
(likely ActionMailer
). Either move that code into ActiveSupport.on_load(:action_mailer)
, or add require "action_view/base"
before that line as a workaround.