Sha256: c0a19803c788917eade1259bddf00a3a63dbd24dc9e81f0b3a3b5a0eb0c9ae89

Contents?: true

Size: 702 Bytes

Versions: 1

Compression:

Stored size: 702 Bytes

Contents

require 'spec_helper'

module Doctors
  describe Search do

    let (:search) { Search.new(location: 'NR1') }

    it 'performs a practice search' do
      stub_request(:get, "http://nhs-api.cloudapp.net/api/Organisations?limit=10&offset=0&organisationtype=GPB").to_return(Fixtures.practices)
      expect(search.results).to have_at_least(1).item
      search.results.each { |result| expect(result).to be_a Practice }
    end

    it 'raises an API::Error on a non-200 response' do
      stub_request(:get, "http://nhs-api.cloudapp.net/api/Organisations?limit=10&offset=0&organisationtype=GPB").to_return(Fixtures.not_found)
      expect { search.results }.to raise_error API::Error
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
doctors-0.0.1 spec/lib/doctors/search_spec.rb