Skip to content

[Rails5] Add `raise: false` to skip_before_action in authenticates_with_two_factor.rb

What does this MR do?

Rails 5.0 raises ArgumentErrror if an unrecognised callback is skipped.

app/controllers/concerns/authenticates_with_two_factor.rb skips require_no_authentication which is not placed in the file (it's part of devise). In this case rails4 doesn't raise an error, but rails5 does.

This MR explicitly tells not to raise an error here.

Fixes:

% RAILS5=1 rspec spec/controllers/omniauth_callbacks_controller_spec.rb

# DEPRECATION MESSAGES SKIPPED

An error occurred while loading ./spec/controllers/omniauth_callbacks_controller_spec.rb.
Failure/Error: skip_before_action :require_no_authentication, only: [:create]

ArgumentError:
  Before process_action callback :require_no_authentication has not been defined
# /usr/share/gems/ruby2.3/gems/activesupport-5.0.6/lib/active_support/callbacks.rb:641:in `block (2 levels) in skip_callback'
# /usr/share/gems/ruby2.3/gems/activesupport-5.0.6/lib/active_support/callbacks.rb:637:in `each'

Are there points in the code the reviewer needs to double check?

No.

Why was this MR needed?

Migration to Rails 5.0

Screenshots (if relevant)

No.

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

#14286 (closed) and !12841 (closed)

Merge request reports