Sha256: 620432ad2c8d1009221c6eca5b83171d0c70d01968f1d3c9889e0678de0a871a
Contents?: true
Size: 1.4 KB
Versions: 3
Compression:
Stored size: 1.4 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') module WhosGotDirt::Responses::Entity RSpec.describe LittleSis do context 'when successful', vcr: {cassette_name: 'little_sis_entity'} do let :response do Faraday.get("https://api.littlesis.org/entities.xml?q=bar&_key=#{ENV['LITTLE_SIS_API_KEY']}") end let :instance do LittleSis.new(response) end describe '#to_a' do it 'should return the results' do expect{instance.to_a}.to_not raise_error end end describe '#count' do it 'should return the number of results' do expect(instance.count).to be > 1_000 end end describe '#page' do it 'should return the current page number' do expect(instance.page).to eq(1) end end end context 'when unsuccessful', vcr: {cassette_name: 'little_sis_entity_error'} do let :response do Faraday.get("https://api.littlesis.org/entities.xml?q=bar") end let :instance do LittleSis.new(response) end describe '#error_message' do it 'should return the error message' do expect(instance.error_message).to eq('Your request must include a query parameter named "_key" with a valid API key value. To obtain an API key, visit http://api.littlesis.org/register.') end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
whos_got_dirt-0.0.5 | spec/responses/entity/little_sis_spec.rb |
whos_got_dirt-0.0.4 | spec/responses/entity/little_sis_spec.rb |
whos_got_dirt-0.0.3 | spec/responses/entity/little_sis_spec.rb |