Sha256: a765e16e446c4f3d7b5db066a81e9b2b323acc2682e2aeec577dd0d77b6a9e17

Contents?: true

Size: 1.37 KB

Versions: 6

Compression:

Stored size: 1.37 KB

Contents

require 'spec_helper'

describe Koala::Facebook::APIError do
  it "is a StandardError" do
    Koala::Facebook::APIError.new.should be_a(StandardError)
  end

  it "has an accessor for fb_error_type" do
    Koala::Facebook::APIError.instance_methods.map(&:to_sym).should include(:fb_error_type)
    Koala::Facebook::APIError.instance_methods.map(&:to_sym).should include(:fb_error_type=)
  end

  it "has an accessor for raw_response" do
    Koala::Facebook::APIError.instance_methods.map(&:to_sym).should include(:raw_response)
    Koala::Facebook::APIError.instance_methods.map(&:to_sym).should include(:raw_response=)
  end

  it "sets raw_response to the provided error details" do
    error_response = {"type" => "foo", "other_details" => "bar"}
    Koala::Facebook::APIError.new(error_response).raw_response.should == error_response
  end
  
  it "sets fb_error_type to details['type']" do
    type = "foo"
    Koala::Facebook::APIError.new("type" => type).fb_error_type.should == type
  end

  it "sets the error message details['type']: details['message']" do
    type = "foo"
    message = "bar"
    error = Koala::Facebook::APIError.new("type" => type, "message" => message)
    error.message.should =~ /#{type}/
    error.message.should =~ /#{message}/
  end
end

describe Koala::KoalaError do
  it "is a StandardError" do
     Koala::KoalaError.new.should be_a(StandardError)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
koala-1.4.1 spec/cases/error_spec.rb
koala-1.4.0 spec/cases/error_spec.rb
koala-1.4.0.rc1 spec/cases/error_spec.rb
koala-1.3.0 spec/cases/error_spec.rb
koala-1.3.0rc2 spec/cases/error_spec.rb
koala-1.3.0rc1 spec/cases/error_spec.rb