Sha256: 2962fc58128dea4f1ec51623ac8dfac51cc09ebe050aa74ed533adf4cd4aa40e
Contents?: true
Size: 1.42 KB
Versions: 1
Compression:
Stored size: 1.42 KB
Contents
# frozen_string_literal: true RSpec.describe Foederati::Provider do describe '#urls' do subject { described_class.new(:new_provider).urls } it { is_expected.to respond_to :api } it { is_expected.to respond_to :site } end describe '#results' do subject { described_class.new(:new_provider).results } it { is_expected.to respond_to :items } it { is_expected.to respond_to :total } end describe '#fields' do subject { described_class.new(:new_provider).fields } it { is_expected.to respond_to :title } it { is_expected.to respond_to :thumbnail } it { is_expected.to respond_to :url } end describe '#initialize' do it 'evaluates a given block' do provider = described_class.new(:new_provider) do urls.api = 'http://api.example.com/' end expect(provider.urls.api).to eq('http://api.example.com/') end end describe '#search' do let(:search_params) { { query: 'fish' } } it 'creates and executes a request' do provider = described_class.new(:new_provider) mock_request = double(Foederati::Provider::Request) mock_response = double(Foederati::Provider::Response) allow(provider).to receive(:request).and_return(mock_request) expect(mock_request).to receive(:execute).with(search_params).and_return(mock_response) expect(mock_response).to receive(:normalise) provider.search(search_params) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
foederati-0.1.0 | spec/lib/foederati/provider_spec.rb |