Sha256: 01414f03f558e48b6983396df9a241302dc4c9dca6e93fd67e9625e5f3048b67

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'
require 'pry'

describe Collections::Client do
  before do
    @client = Collections::Client.new
    @client.configure do |config|
      config.auth_token = "abc123"
    end
  end

  describe '#return_captures_for_uuid' do
    before do
      stub_request(:get, "http://api.repo.nypl.org/api/v1/items/5fa75050-c6c7-012f-e24b-58d385a7bc34?withTitles=yes&per_page=10").
         with(:headers => {'Authorization'=>'Token token=abc123'}).
         to_return(body: fixture('return_captures_for_uuid.json'))
    end

    it "fetches the first ten results" do
      results = @client.return_captures_for_uuid('5fa75050-c6c7-012f-e24b-58d385a7bc34', withTitles: 'yes', per_page: '10')
      results = JSON.parse(results.body)
      expect(a_request(:get, "http://api.repo.nypl.org/api/v1/items/5fa75050-c6c7-012f-e24b-58d385a7bc34?withTitles=yes&per_page=10").
         with(:headers => {'Authorization'=>'Token token=abc123'})).
         to have_been_made
      expect(results.first[1].first[1].first[1]).to eq "5fa75050-c6c7-012f-e24b-58d385a7bc34"
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nypl-collections-0.0.1 spec/nypl_collections/client_spec.rb