controller tests all broken on rails 5 because they want to be integration tests
grosser opened this issue · 5 comments
Did not see the memo that controller tests are bad now ... seem to work fine when used manually via < ActionController::TestCase
... but describe XyZController
style no longer works :(
using this to fix it
# https://github.com/blowmage/minitest-rails/issues/195
class ActionController::TestCase
# Use AD::IntegrationTest for the base class when describing a controller
register_spec_type(self) do |desc|
Class === desc && desc < ActionController::Metal
end
end
Saw that ... but I don't want it to be optional ... I'm thinking it should
just work since controller tests are still supported / not discouraged ?
On Sun, May 15, 2016 at 9:01 AM, Mike Moore notifications@github.com
wrote:
@grosser https://github.com/grosser See #194
https://github.com/blowmage/minitest-rails/pull/194.—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
https://github.com/blowmage/minitest-rails/issues/195#issuecomment-219294151
Use of ActionController::TestCase is discouraged. The generators now produce test files that inherit from ActionDispatch::IntegrationTest. AC::TC is deprecated in Rails 5.0 and will be removed in Rails 5.1.
The problem we face is what is the behavior of the spec DSL when describing a Controller class. Do we follow the Rails 5.0 approach and use AD::IT? If we do this we need a way for folks to opt-in for the Rais 4 approach. Or do we follow the Rails 4 approach and use AC::TC? If we do this we need a way for folks to opt in for the Rails 5.0 approach
The problem with following the Rails 4 approach is that it changes again once Rails 5.1 comes out. Besides being backwards looking it means we have to support two different opt-in options in Rails 5.0 and 5.1.
It is cleaner IMO to have minitest-rails 3.0 embrace the new way of handling controller tests, and have a single opt-in mechanism for specifying the old behavior. That mechanism, looking for the rails-controller-testing gem, is also how AC::TC will be made available in Rails 5.1.
Nvm then ... did not see any deprecations :(
Should use the new style to be compatible going forward ... I'll use the hack in the meantime to do our upgrades more slowly / 1-by-1