Sha256: e747081c802f7bde18f85b5b6beb9f80f31181cda03f9d4b4f832513e935ea21
Contents?: true
Size: 952 Bytes
Versions: 1
Compression:
Stored size: 952 Bytes
Contents
require 'spec_helper' describe Apress::YandexMarket::Readers::ModelByCategory do let(:categories) { 'Красота' } # id: 90509 let(:reader) { described_class.new(token: 'secret_token', categories: categories) } describe '.allowed_options' do it { expect(described_class.allowed_options).to eq %i(token region_id categories) } end describe '#each_row' do let(:rows) { [] } before do allow(reader.category_reader.client).to receive(:get).and_call_original allow(reader.category_reader.client).to receive(:get).with('categories/90509/children', anything). and_return(categories: [{id: 8_476_099, childCount: 0}]) VCR.use_cassette 'read_models_from_category' do reader.each_row { |row| rows << row } end end it 'reads models of specified categories and their subcategories' do expect(rows).to have(840).items expect(rows.uniq).to have(840).items end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
apress-yandex_market-0.1.0 | spec/apress/yandex_market/readers/model_by_category_spec.rb |