Sha256: 90bbbefea04f19aef6888a8bc4790498421454a6eff0e6c3108f0f8c4da04b03
Contents?: true
Size: 1.68 KB
Versions: 1
Compression:
Stored size: 1.68 KB
Contents
require 'spec_helper' describe Reviewed::Product do let(:client) do Reviewed::Client.new(api_key: TEST_KEY, base_uri: TEST_URL) end describe 'associations' do describe 'attachments', vcr: true do before(:each) do Faraday::Cache.store.clear @product = client.products.with_no_cache.find('minden-master-ii') end it 'no longer has_many :attachments' do Reviewed::Product._embedded_many.should_not include({"attachments"=>Reviewed::Attachment}) end it 'returns attachments of the correct class' do @product.attachments(:gallery).each do |attachment| attachment.should be_an_instance_of(Reviewed::Attachment) end end it 'returns attachments by tag' do @product.attachments(:vanity).length.should == 1 end it 'matches attachments by tag properly' do attachments = @product.attachments('vanity') attachments.each do |attachment| attachment.tags.join(',').should match(/vanity/i) end end it 'does not have any matching attachments' do attachments = @product.attachments('doesnotcompute') attachments.length.should == 0 end end end describe 'manufacturer_specs', vcr: true do before(:each) do @product = client.products.find('minden-master-ii') end it 'has_many :manufacturer_specs' do Reviewed::Product._embedded_many.should include({"manufacturer_specs"=>Reviewed::ManufacturerSpec}) end it 'returns attachments of the correct class' do @product.manufacturer_specs.each do |ms| ms.should be_an_instance_of(Reviewed::ManufacturerSpec) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
reviewed-0.6.0 | spec/product_spec.rb |