Sha256: 79113f609a57eeef34b7bc895c3f8098b68cf69addf3b18f91079eb002b35db9

Contents?: true

Size: 1.5 KB

Versions: 65

Compression:

Stored size: 1.5 KB

Contents

require File.dirname(__FILE__) + '/../../spec_helper'

module ActionController
  describe "Rescue", "#rescue_action in default mode" do
    before(:each) do
      @fixture = Object.new
      @fixture.extend ActionController::Rescue
      class << @fixture
        public :rescue_action
      end
    end

    it "should raise the passed in exception so examples fail fast" do
      proc {@fixture.rescue_action(RuntimeError.new("Foobar"))}.should raise_error(RuntimeError, "Foobar")
    end
  end

  class RescueOverriddenController < ActionController::Base
    def rescue_action(error)
      "successfully overridden"
    end
  end

  describe "Rescue", "#rescue_action, when overridden" do
    before(:each) do
      @fixture = RescueOverriddenController.new
    end

    it "should do whatever the overridden method does" do
      @fixture.rescue_action(RuntimeError.new("Foobar")).should == "successfully overridden"
    end
  end

  class SearchController < ActionController::Base
  end

  describe "Rescue", "#rescue_action when told to use rails error handling" do
    before(:each) do
      @controller = SearchController.new
      @controller.use_rails_error_handling!
      class << @controller
        public :rescue_action
      end
    end

    it "should use Rails exception handling" do
      exception = RuntimeError.new("The Error")
      exception.stub!(:backtrace).and_return(caller)
      @controller.should_receive(:rescue_action_locally).with(exception)

      @controller.rescue_action(exception)
    end
  end
end

Version data entries

65 entries across 65 versions & 11 rubygems

Version Path
dchelimsky-rspec-rails-1.1.10 spec/rails/extensions/action_controller_rescue_action_spec.rb
dchelimsky-rspec-rails-1.1.11.1 spec/rails/extensions/action_controller_rescue_action_spec.rb
dchelimsky-rspec-rails-1.1.11.2 spec/rails/extensions/action_controller_rescue_action_spec.rb
dchelimsky-rspec-rails-1.1.11.3 spec/rails/extensions/action_controller_rescue_action_spec.rb
dchelimsky-rspec-rails-1.1.11 spec/rails/extensions/action_controller_rescue_action_spec.rb
dchelimsky-rspec-rails-1.1.6 spec/rails/extensions/action_controller_rescue_action_spec.rb
dchelimsky-rspec-rails-1.1.7 spec/rails/extensions/action_controller_rescue_action_spec.rb
dchelimsky-rspec-rails-1.1.8 spec/rails/extensions/action_controller_rescue_action_spec.rb
dchelimsky-rspec-rails-1.1.9 spec/rails/extensions/action_controller_rescue_action_spec.rb
jcnetdev-rspec-rails-1.1.5 spec/rails/extensions/action_controller_rescue_action_spec.rb
jnstq-acts_as_sms-0.1.0 test/vendor/plugins/rspec-rails/spec/rails/extensions/action_controller_rescue_action_spec.rb
jnstq-acts_as_sms-0.1.1 test/vendor/plugins/rspec-rails/spec/rails/extensions/action_controller_rescue_action_spec.rb
jnstq-acts_as_sms-0.1.3 test/vendor/plugins/rspec-rails/spec/rails/extensions/action_controller_rescue_action_spec.rb
jnstq-acts_as_sms-0.1.4 test/vendor/plugins/rspec-rails/spec/rails/extensions/action_controller_rescue_action_spec.rb
jstorimer-deep-test-2.0.0 sample_rails_project/vendor/plugins/rspec_on_rails/spec/rails/extensions/action_controller_rescue_action_spec.rb
jstorimer-deep-test-1.4.0 sample_rails_project/vendor/plugins/rspec_on_rails/spec/rails/extensions/action_controller_rescue_action_spec.rb
jstorimer-deep-test-1.3.0 sample_rails_project/vendor/plugins/rspec_on_rails/spec/rails/extensions/action_controller_rescue_action_spec.rb
jstorimer-deep-test-1.2.0 sample_rails_project/vendor/plugins/rspec_on_rails/spec/rails/extensions/action_controller_rescue_action_spec.rb
jstorimer-deep-test-1.1.0 sample_rails_project/vendor/plugins/rspec_on_rails/spec/rails/extensions/action_controller_rescue_action_spec.rb
jstorimer-deep-test-1.0.0 sample_rails_project/vendor/plugins/rspec_on_rails/spec/rails/extensions/action_controller_rescue_action_spec.rb