Sha256: c3005b31a6930967d5fe8fc74449dd25b6f1eca159b9b8550daef059255d13f8
Contents?: true
Size: 1.25 KB
Versions: 1
Compression:
Stored size: 1.25 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') module WhosGotDirt::Requests::List RSpec.describe OpenCorporates do describe '#to_s' do it 'should return the URL to request' do expect(OpenCorporates.new(name: 'barclays').to_s).to eq('https://api.opencorporates.com/corporate_groupings/search?q=barclays') end end describe '#convert' do context 'when given a name' do include_examples 'match', 'q', 'name', ['barclays', 'bayclay'] end context 'when given a limit' do it 'should return a per-page limit' do expect(OpenCorporates.new('limit' => 5).convert).to eq('per_page' => 5) end it 'should override the default authenticated per-page limit' do expect(OpenCorporates.new('limit' => 5, 'open_corporates_api_key' => 123).convert).to eq('per_page' => 5, 'api_token' => 123) end end context 'when given a page' do include_examples 'equal', 'page', 'page', 2 end context 'when given an API key' do it 'should return an API key parameter' do expect(OpenCorporates.new('open_corporates_api_key' => 123).convert).to eq('api_token' => 123, 'per_page' => 100) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
whos_got_dirt-0.0.5 | spec/requests/list/open_corporates_spec.rb |