Sha256: 455c669941fe436cfdddefbbc8b40122b70fb4ceb344c8964636be941d0c2cd3

Contents?: true

Size: 959 Bytes

Versions: 3

Compression:

Stored size: 959 Bytes

Contents

require 'spec_helper'

describe Youku::V2::Searches do

  let(:client)   { Youku::Client.new(client_id: 'client-id') }
  let(:searches) { Youku::V2::Searches.new(client) }

  describe '#video' do
    subject { searches.video }

    it { expect(subject).to be_a Youku::V2::Searches::Video }
    it { expect(subject.client).to eq client }
  end

  describe '::Video' do
    let(:video) { Youku::V2::Searches::Video.new(client) }

    describe '#by_keyword' do
      let(:url) { 'https://openapi.youku.com/v2/searches/video/by_keyword.json' }
      let(:query) { {
        client_id: client.client_id,
        keyword:   2014,
        period:    'week',
        orderby:   'published',
        page:      1,
        count:     20
      } }

      before do
        stub_request(:get, url).with(query: query).to_return(status: 200)
      end

      subject { video.by_keyword(2014) }

      it_should_behave_like 'a base Youku API V2 requests'
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
youku_client-0.0.3 spec/youku/v2/searches_spec.rb
youku_client-0.0.2 spec/youku/v2/searches_spec.rb
youku_client-0.0.1 spec/youku/v2/searches_spec.rb