Sha256: aff1f912db0a4bd8662e9b717c850e57fda3a3551a2c302b2d59e3f02bc30e1b

Contents?: true

Size: 847 Bytes

Versions: 4

Compression:

Stored size: 847 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'=>'*/*',
                        '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

4 entries across 4 versions & 1 rubygems

Version Path
baruwa-0.0.7 spec/baruwa_incorrect_method_spec.rb
baruwa-0.0.6 spec/baruwa_incorrect_method_spec.rb
baruwa-0.0.5 spec/baruwa_incorrect_method_spec.rb
baruwa-0.0.4 spec/baruwa_incorrect_method_spec.rb