Sha256: 189e6d3043d4a2bcf29358cd120fa86a82019d2b67e14bcdc7c11de6c57cb6c9

Contents?: true

Size: 801 Bytes

Versions: 3

Compression:

Stored size: 801 Bytes

Contents

require_relative '../spec_helper'
require_relative '../../lib/remote_client'

module RescueGroups
  describe RemoteClient do
    describe '#post_and_respond' do
      let(:connection) { instance_double(Faraday::Connection) }

      before do
        allow(Response).to receive(:new)
        allow(subject).to receive(:connection) { connection }
      end

      it 'calls the class post on the connection' do
        expect(connection).to receive(:post)
        subject.post_and_respond({})
      end

      context 'with no api key' do
        before do
          allow(RescueGroups.config).to receive(:apikey) { nil }
        end

        it 'raises an error' do
          expect { subject.post_and_respond({}) }.to raise_error('No RescueGroups API Key set')
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rescue_groups-1.2.0 spec/lib/remote_client_spec.rb
rescue_groups-1.1.0 spec/lib/remote_client_spec.rb
rescue_groups-1.0.0 spec/lib/remote_client_spec.rb