Sha256: 4261f53dc541056ceaa84cb23a5893bc6b40cd267864c1aa2c392950eb74ad82

Contents?: true

Size: 754 Bytes

Versions: 5

Compression:

Stored size: 754 Bytes

Contents

require 'spec_helper'

describe Restfulie::Client::Feature::RescueException do
  
  before do
    @feature = Restfulie::Client::Feature::RescueException.new
    @request = Object.new
    @chain = mock Restfulie::Client::StackNavigator
  end
  
  context "when executing a request" do
    
    it "should return an exception if something bad occurs" do
      exception = mock Exception
      @chain.should_receive(:continue).and_raise(exception)
      @feature.execute(@chain, @request, {})
    end
    
    it "should return the response if everything goes fine" do
      response = mock Net::HTTPResponse
      @chain.should_receive(:continue).and_return(response)
      @feature.execute(@chain, @request, {}).should == response
    end
    
  end

end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
restfulie-nosqlite-1.0.4 spec/unit/client/feature/rescue_exception_spec.rb
restfulie-1.1.1 spec/unit/client/feature/rescue_exception_spec.rb
restfulie-1.1.0 spec/unit/client/feature/rescue_exception_spec.rb
restfulie-nosqlite-1.0.3 spec/unit/client/feature/rescue_exception_spec.rb
restfulie-1.0.3 spec/unit/client/feature/rescue_exception_spec.rb