-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrap helper_method calls in respond_to?(:helper_method) #3732
Wrap helper_method calls in respond_to?(:helper_method) #3732
Conversation
|
||
test 'defines methods like current_user' do | ||
assert @controller.respond_to?(:current_user) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the builtin methods: assert_includes
, assert_respond_to
and refute_respond_to
. They provide nicer error messages in case of test failures.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, thank you.
+1 |
This seems like a good solution, rather than adding mock support for this method in Rails 5 api code. |
Any updates on this PR? Thanks! |
Sorry, for the delay, thanks for the fix ❤️ |
Wrap helper_method calls in respond_to?(:helper_method)
Thanks! On Sat, Sep 26, 2015, 10:05 AM Lucas Mazza [email protected] wrote:
|
Add #3732 helper logic to devise controller
Currently `Monban::ControllerHelpers` depends on `#helper_method`, which is defined inside `AbstractController::Helpers`. This module is included in `ActionController::Base`, but it is not included by default in `ActionController::Metal`. So it's not available in Ruby on Rails 5.0 applications in API mode (rails-api). `#helper_method` is not essential to the functionality of the methods inside `Monban::ControllerHelpers`, so this PR wraps all `#helper_method` calls with `respond_to?(:helper_method)` checks. See rails/rails#21067 and heartcombo/devise#3732 for reference.
Currently `Monban::ControllerHelpers` depends on `#helper_method`, which is defined inside `AbstractController::Helpers`. This module is included in `ActionController::Base`, but it is not included by default in `ActionController::Metal`. So it's not available in Ruby on Rails 5.0 applications in API mode (rails-api). `#helper_method` is not essential to the functionality of the methods inside `Monban::ControllerHelpers`, so this PR wraps all `#helper_method` calls with `respond_to?(:helper_method)` checks. See rails/rails#21067 and heartcombo/devise#3732 for reference.
In API mode, the view layer is not available and these trigger method_missing errors. This fix is similar to how devise solved this problem: heartcombo/devise#3732
In API mode, the view layer is not available and these trigger method_missing errors. This fix is similar to how devise solved this problem: heartcombo/devise#3732
In API mode, the view layer is not available and these trigger method_missing errors. This fix is similar to how devise solved this problem: heartcombo/devise#3732
In API mode, the view layer is not available and these trigger method_missing errors. This fix is similar to how devise solved this problem: heartcombo/devise#3732
In API mode, the view layer is not available and these trigger method_missing errors. This fix is similar to how devise solved this problem: heartcombo/devise#3732
In API mode, the view layer is not available and these trigger method_missing errors. This fix is similar to how devise solved this problem: heartcombo/devise#3732
In API mode, the view layer is not available and these trigger method_missing errors. This fix is similar to how devise solved this problem: heartcombo/devise#3732
In API mode, the view layer is not available and these trigger method_missing errors. This fix is similar to how devise solved this problem: heartcombo/devise#3732
In API mode, the view layer is not available and these trigger method_missing errors. This fix is similar to how devise solved this problem: heartcombo/devise#3732
Currently
Devise::Controllers::Helpers
depends on#helper_method
, which is defined insideAbstractController::Helpers
. This module is included inActionController::Base
, but it is not included by default inActionController::Metal
.#helper_method
is not essential to the functionality of the methods insideDevise::Controllers::Helpers
, so this PR wraps all Devise#helper_method
calls withrespond_to?(:helper_method)
checks.