Sha256: 42b19f24851ad5b0636f377f5f5dcb0303c22ee5da1a34a8e514af7e1799e0d8

Contents?: true

Size: 1.21 KB

Versions: 34

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'

describe FbGraph::Exception do
  context 'when response body is given' do
    it 'should setup message and type from error' do
      err = FbGraph::Exception.new(400, 'This is the original message', {
        :error => {
          :type => 'SomeError',
          :message => 'This is the error message'
        }
      }.to_json)
      err.code.should == 400
      err.type.should == 'SomeError'
      err.message.should == 'This is the error message'
    end
  end

  context 'when response body is not given' do
    it 'should not have type' do
      err = FbGraph::Exception.new(400, 'This is the original message')
      err.code.should == 400
      err.type.should be_nil
      err.message.should == 'This is the original message'
    end
  end
end

describe FbGraph::BadRequest do
  it 'should have 400 status code' do
    err = FbGraph::BadRequest.new 'Bad Request'
    err.code.should == 400
  end
end

describe FbGraph::Unauthorized do
  it 'should have 401 status code' do
    err = FbGraph::Unauthorized.new 'Unauthorized'
    err.code.should == 401
  end
end

describe FbGraph::NotFound do
  it 'should have 404 status code' do
    err = FbGraph::NotFound.new 'Not Found'
    err.code.should == 404
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
fb_graph-2.1.7 spec/fb_graph/exception_spec.rb
fb_graph-2.1.6 spec/fb_graph/exception_spec.rb
fb_graph-2.1.5 spec/fb_graph/exception_spec.rb
fb_graph-2.1.4 spec/fb_graph/exception_spec.rb
fb_graph-2.1.3 spec/fb_graph/exception_spec.rb
fb_graph-2.1.2 spec/fb_graph/exception_spec.rb
fb_graph-2.1.1 spec/fb_graph/exception_spec.rb
fb_graph-2.1.0 spec/fb_graph/exception_spec.rb
fb_graph-2.1.0.alpha spec/fb_graph/exception_spec.rb
fb_graph-2.0.2 spec/fb_graph/exception_spec.rb
fb_graph-2.0.1 spec/fb_graph/exception_spec.rb
fb_graph-2.0.0 spec/fb_graph/exception_spec.rb
fb_graph-2.0.0.beta spec/fb_graph/exception_spec.rb
fb_graph-2.0.0.alpha spec/fb_graph/exception_spec.rb
fb_graph-1.9.5 spec/fb_graph/exception_spec.rb
fb_graph-1.9.4 spec/fb_graph/exception_spec.rb
fb_graph-1.9.3 spec/fb_graph/exception_spec.rb
fb_graph-1.9.2 spec/fb_graph/exception_spec.rb
fb_graph-1.9.1 spec/fb_graph/exception_spec.rb
fb_graph-1.9.0 spec/fb_graph/exception_spec.rb