Sha256: 4bfea4f3826ace6c2356510d39f3cd7f366ba8de8849b7bff2d8bdc6eec25a6c

Contents?: true

Size: 848 Bytes

Versions: 5

Compression:

Stored size: 848 Bytes

Contents

require File.dirname(__FILE__)+'/../spec_helper'
describe Restfully::HTTP::Error do
  it "should have a response reader" do
    response = mock("restfully response", :status => 404, :body => {'title' => 'Not Found', 'message' => 'The requested resource cannot be found.', 'code' => 404})
    error = Restfully::HTTP::Error.new(response)
    error.response.should == response
  end
  it "should work properly" do
    response = mock("restfully response", :status => 404, :body => {'title' => 'Not Found', 'message' => 'The requested resource cannot be found.', 'code' => 404})
    begin
      raise Restfully::HTTP::Error.new(response)
    rescue Restfully::HTTP::Error => e
      e.response.should == response
      e.message.should == "404 Not Found. The requested resource cannot be found."
      e.backtrace.should_not be_empty
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
crohr-restfully-0.2.1 spec/http/error_spec.rb
crohr-restfully-0.2.2 spec/http/error_spec.rb
restfully-0.2.3 spec/http/error_spec.rb
restfully-0.2.2 spec/http/error_spec.rb
restfully-0.2.1 spec/http/error_spec.rb