Sha256: c4006cf4915c80d966ee4ff8d9f4af11e62f6e8bc89b6dee753f3095847510d4

Contents?: true

Size: 1.24 KB

Versions: 19

Compression:

Stored size: 1.24 KB

Contents

module ActionController
  module Rescue
    def use_rails_error_handling!
      Kernel.warn <<-WARNING
DEPRECATION NOTICE: controller.use_rails_error_handling! is
deprecated and will be removed from a future version of
rspec-rails.

Use rescue_action_in_public!, which is defined directly in
rails' testing framework, instead.
WARNING
      if Rails::VERSION::STRING =~ /^2\.0/
        @use_rails_error_handling = true
      else
        # anything but 0.0.0.0 - borrowed from rails own rescue_action_in_public!
        request.remote_addr = '208.77.188.166'
      end
    end
    
    def use_rails_error_handling?
      @use_rails_error_handling ||= false
    end

  protected
  
    if Rails::VERSION::STRING =~ /^2\.0/
      def rescue_action_in_public?
        request.respond_to?(:rescue_action_in_public?) and request.rescue_action_in_public?
      end
      
      def rescue_action_with_handler_with_fast_errors(exception)
        if (use_rails_error_handling? || rescue_action_in_public?) & !handler_for_rescue(exception)
          rescue_action_in_public(exception)
        else
          rescue_action_with_handler_without_fast_errors(exception)
        end
      end
      alias_method_chain :rescue_action_with_handler, :fast_errors
    end

  end
end

Version data entries

19 entries across 19 versions & 4 rubygems

Version Path
cavalle-rspec-rails-1.2.2.0.1 lib/spec/rails/extensions/action_controller/rescue.rb
cavalle-rspec-rails-1.2.2.0.2 lib/spec/rails/extensions/action_controller/rescue.rb
cavalle-rspec-rails-1.2.3.1 lib/spec/rails/extensions/action_controller/rescue.rb
cavalle-rspec-rails-1.2.4.0.1 lib/spec/rails/extensions/action_controller/rescue.rb
dchelimsky-rspec-rails-1.1.99.13 lib/spec/rails/extensions/action_controller/rescue.rb
dchelimsky-rspec-rails-1.1.99.6 lib/spec/rails/extensions/action_controller/rescue.rb
dchelimsky-rspec-rails-1.1.99.7 lib/spec/rails/extensions/action_controller/rescue.rb
dchelimsky-rspec-rails-1.1.99.8 lib/spec/rails/extensions/action_controller/rescue.rb
dchelimsky-rspec-rails-1.1.99.9 lib/spec/rails/extensions/action_controller/rescue.rb
mcmire-rspec-rails-1.1.99.9 lib/spec/rails/extensions/action_controller/rescue.rb
rspec-rails-1.2.7 lib/spec/rails/extensions/action_controller/rescue.rb
rspec-rails-1.2.7.1 lib/spec/rails/extensions/action_controller/rescue.rb
rspec-rails-1.2.0 lib/spec/rails/extensions/action_controller/rescue.rb
rspec-rails-1.2.4 lib/spec/rails/extensions/action_controller/rescue.rb
rspec-rails-1.2.1 lib/spec/rails/extensions/action_controller/rescue.rb
rspec-rails-1.2.3 lib/spec/rails/extensions/action_controller/rescue.rb
rspec-rails-1.2.2 lib/spec/rails/extensions/action_controller/rescue.rb
rspec-rails-1.2.6 lib/spec/rails/extensions/action_controller/rescue.rb
rspec-rails-1.2.5 lib/spec/rails/extensions/action_controller/rescue.rb