Sha256: ab6c05c3513a972fbc042409c610e7e665ecbfc5d62c62830eb224a7d25747a3

Contents?: true

Size: 1.25 KB

Versions: 32

Compression:

Stored size: 1.25 KB

Contents

require File.join(File.dirname(__FILE__), '../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

32 entries across 32 versions & 1 rubygems

Version Path
fb_graph-1.7.0 spec/fb_graph/exception_spec.rb
fb_graph-1.7.0.alpha2 spec/fb_graph/exception_spec.rb
fb_graph-1.6.9 spec/fb_graph/exception_spec.rb
fb_graph-1.7.0.alpha spec/fb_graph/exception_spec.rb
fb_graph-1.6.8 spec/fb_graph/exception_spec.rb
fb_graph-1.6.7 spec/fb_graph/exception_spec.rb
fb_graph-1.6.5 spec/fb_graph/exception_spec.rb
fb_graph-1.6.4 spec/fb_graph/exception_spec.rb
fb_graph-1.6.3 spec/fb_graph/exception_spec.rb
fb_graph-1.6.2 spec/fb_graph/exception_spec.rb
fb_graph-1.6.1 spec/fb_graph/exception_spec.rb
fb_graph-1.6.0 spec/fb_graph/exception_spec.rb
fb_graph-1.5.5 spec/fb_graph/exception_spec.rb
fb_graph-1.5.4 spec/fb_graph/exception_spec.rb
fb_graph-1.5.3 spec/fb_graph/exception_spec.rb
fb_graph-1.5.2 spec/fb_graph/exception_spec.rb
fb_graph-1.5.1 spec/fb_graph/exception_spec.rb
fb_graph-1.5.0 spec/fb_graph/exception_spec.rb
fb_graph-1.4.1 spec/fb_graph/exception_spec.rb
fb_graph-1.4.0 spec/fb_graph/exception_spec.rb