Sha256: 3c00899b4c2f3da44677337f2cc0ef09681b34eade5da74420746cad2eb8c1d1
Contents?: true
Size: 1.82 KB
Versions: 1
Compression:
Stored size: 1.82 KB
Contents
require "spec_helper" require "json" require "webmock/rspec" module Photomosaic module SearchEngine describe Bing do let(:api_key) do "api_key" end let(:search_keyword) do "keyword" end let(:results) do 30 end let(:client) do described_class.new(api_key, results) end describe "#get_image_list" do before do stub_request( :get, "https://:#{api_key}@api.datamarket.azure.com/Bing/Search/v1/Composite?$format=json&$skip=0&$top=#{results}&Query='#{search_keyword}'&Sources='Image'" ) .to_return( status: 200, body: JSON.generate( d: { results: [ { Image: [ { MediaUrl: "http://example.com/image01.jpg" }, { MediaUrl: "http://example.com/image02.jpg" } ] } ] } ) ) end it "should return image list" do expect(client.get_image_list(search_keyword)) .to match_array [ "http://example.com/image01.jpg", "http://example.com/image02.jpg" ] end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
photomosaic-0.0.1 | spec/photomosaic/search_engine/bing_spec.rb |