Sha256: 7af69ee9efe1d10372af76aa5cb3a3efc38b5a261ffecee58dbdcec14b74e28f

Contents?: true

Size: 782 Bytes

Versions: 8

Compression:

Stored size: 782 Bytes

Contents

ActionController::Base.class_eval do
  cattr_accessor :allow_rescue
  
  alias_method :rescue_action_without_bypass, :rescue_action

  def rescue_action(exception)
    if ActionController::Base.allow_rescue
      rescue_action_without_bypass(exception)
    else
      raise exception
    end
  end
end

begin
  ActionController::Failsafe.class_eval do
    alias_method :failsafe_response_without_bypass, :failsafe_response
  
    def failsafe_response(exception)
      raise exception
    end
  end
rescue NameError # Failsafe was introduced in Rails 2.3.2
  ActionController::Dispatcher.class_eval do
    def self.failsafe_response(output, status, exception = nil)
      raise exception
    end
  end
end

Before('@allow-rescue') do
  ActionController::Base.allow_rescue = true
end

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
aslakhellesoy-cucumber-0.3.102.1 lib/cucumber/rails/action_controller.rb
aslakhellesoy-cucumber-0.3.102.2 lib/cucumber/rails/action_controller.rb
aslakhellesoy-cucumber-0.3.103 lib/cucumber/rails/action_controller.rb
aslakhellesoy-cucumber-0.3.104 lib/cucumber/rails/action_controller.rb
kosmas58-cucumber-0.3.102 lib/cucumber/rails/action_controller.rb
kosmas58-cucumber-0.3.103 lib/cucumber/rails/action_controller.rb
cucumber-0.3.104 lib/cucumber/rails/action_controller.rb
cucumber-0.3.103 lib/cucumber/rails/action_controller.rb