Sha256: 9d9cd93141511275e80571b3a272b5d926fc15a6f4b27e2e75cf8e8197456263

Contents?: true

Size: 907 Bytes

Versions: 2

Compression:

Stored size: 907 Bytes

Contents

require 'spec_helper'

describe 'Test Exceptions' do
    before do
        @baruwapi = BaruwaAPI.new('https://testbaruwa.com', '6e2347bc-278e-42f6-a84b-fa1766140cbd')
    end

    it 'should raise an argument error' do
        ENDPOINT = {:name => '/status', :method => :patch}
        expect {@baruwapi.get_request(ENDPOINT, ENDPOINT[:name])}.to raise_error(ArgumentError)
    end

    it 'should raise an error' do
        stub_request(:get, "https://testbaruwa.com/api/v1/status").
        with(:body => false,
            :headers => {'Accept'=>'*/*',
                        'Content-Type'=>'application/json',
                        'User-Agent'=>'BaruwaAPI-Ruby',
                        'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
        to_return(:status => 500, :body => "", :headers => {})
        expect {@baruwapi.get_status()}.to raise_error(StandardError)
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
baruwa-0.0.3 spec/baruwa_incorrect_method_spec.rb
baruwa-0.0.2 spec/baruwa_incorrect_method_spec.rb