Sha256: 9d317af3c24e91854be2282cbfe69a6d98e0b3b0c512bbdc47af57513ed252e0

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')

module WhosGotDirt::Requests::Entity
  RSpec.describe LittleSis do
    describe '#to_s' do
      it 'should return the URL to request' do
        expect(LittleSis.new(name: 'ACME Inc.').to_s).to eq('https://api.littlesis.org/entities.xml?q=ACME+Inc.')
      end
    end

    describe '#convert' do
      context 'when given a name' do
        include_examples 'match', 'q', 'name', ['ACME Inc.', 'Inc. ACME']
      end

      context 'when given a classification' do
        include_examples 'one_of', 'type_ids', 'classification', [1, 2], ','
      end

      context 'when given a limit' do
        include_examples 'equal', 'num', 'limit', 5
      end

      context 'when given a page' do
        include_examples 'equal', 'page', 'page', 2
      end

      context 'when given an API key' do
        include_examples 'equal', '_key', 'little_sis_api_key', 123
      end

      context 'when given a "search all" flag' do
        include_examples 'equal', 'search_all', 'search_all', 1, valid: [1]
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
whos_got_dirt-0.0.5 spec/requests/entity/little_sis_spec.rb