Sha256: ce8bdb8f264a7d4ab7cb268781cddcb15baa79e1ebcf960edc8edad1b2d1d439

Contents?: true

Size: 1017 Bytes

Versions: 3

Compression:

Stored size: 1017 Bytes

Contents

# FIXME: this should be in a module that only gets loaded in integration tests
# This monkeypatch currently makes it impossible to create isolated controller specs
# that pass through exceptions (see “Expecting Errors” on
# http://rspec.info/rdoc-rails/classes/Spec/Rails/Example/ControllerExampleGroup.html)
ActionController::Base.class_eval do
  def use_rails_error_handling_with_integration_support?
    if Spec::Integration::DSL::IntegrationExample::during_integration_example
      true
    else
      use_rails_error_handling_without_integration_support?
    end
  end
  alias_method_chain :use_rails_error_handling?, :integration_support
  
  attr_reader :rescued_exception
  def rescue_action_with_integration_support(e)
    if Spec::Integration::DSL::IntegrationExample::during_integration_example
      @rescued_exception = e
      rescue_action_without_fast_errors e
    else
      rescue_action_without_integration_support e
    end
  end
  alias_method_chain :rescue_action, :integration_support
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
radiant-0.7.2 vendor/plugins/spec_integration/lib/spec/integration/extensions/action_controller.rb
radiant-0.7.0 vendor/plugins/spec_integration/lib/spec/integration/extensions/action_controller.rb
radiant-0.7.1 vendor/plugins/spec_integration/lib/spec/integration/extensions/action_controller.rb