Sha256: 384155b20dd6923ffd001953006f13b39bf4081ef65e729058608267936ebd09
Contents?: true
Size: 1023 Bytes
Versions: 6
Compression:
Stored size: 1023 Bytes
Contents
shared_examples "search request" do before(:all) do @api_key = "xyz" @params = {} end before(:each) do stub_request(:get, /www.europeana.eu\/api\/v2\/search\.json/).to_return(:body => '{"success":true}') end it_behaves_like "API request" context "with API key" do before(:all) do Europeana.api_key = @api_key end it "sends a Search request to the API" do subject expect(a_request(:get, /www.europeana.eu\/api\/v2\/search\.json/)).to have_been_made.once end context "without query" do it "sets an empty query" do subject expect(a_request(:get, /www.europeana.eu\/api\/v2\/search\.json\?query=/)).to have_been_made.once end end context "with query" do before(:all) do @params = { :query => "test" } end it "sends query" do subject expect(a_request(:get, /www.europeana.eu\/api\/v2\/search\.json\?query=test/)).to have_been_made.once end end end end
Version data entries
6 entries across 6 versions & 2 rubygems