Sha256: ff3531837d36ffdea7d646134468311666cbb86c617714a2966347476ab2738c

Contents?: true

Size: 1.14 KB

Versions: 14

Compression:

Stored size: 1.14 KB

Contents

require 'spec_helper'

describe Spree::ProductsController do

  let!(:product) { FactoryGirl.create(:product) }

  describe 'on :show to a product without any stores' do
    let!(:store) { FactoryGirl.create(:store) }

    it 'returns 404' do
      spree_get :show, :id => product.to_param

      expect(response.response_code).to eq 404
    end
  end

  # Regression test for #75
  describe 'on :show to a product in the wrong store' do
    let!(:store_1) { FactoryGirl.create(:store) }
    let!(:store_2) { FactoryGirl.create(:store) }

    before(:each) do
      product.stores << store_1
    end

    it 'returns 404' do
      allow(controller).to receive_messages(:current_store => store_2)
      spree_get :show, :id => product.to_param

      expect(response.response_code).to eq 404
    end
  end

  describe 'on :show to a product w/ store' do
    let!(:store) { FactoryGirl.create(:store) }

    before(:each) do
      product.stores << store
    end

    it 'returns 200' do
      allow(controller).to receive_messages(:current_store => store)
      spree_get :show, :id => product.to_param

      expect(response.response_code).to eq 200
    end
  end

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
solidus_multi_domain-1.5.0 spec/controllers/spree/products_controller_spec.rb
solidus_multi_domain-1.4.3 spec/controllers/spree/products_controller_spec.rb
solidus_multi_domain-1.4.2 spec/controllers/spree/products_controller_spec.rb
solidus_multi_domain-1.4.1 spec/controllers/spree/products_controller_spec.rb
solidus_multi_domain-1.4.0 spec/controllers/spree/products_controller_spec.rb
solidus_multi_domain-1.3.0 spec/controllers/spree/products_controller_spec.rb
solidus_multi_domain-1.2.0 spec/controllers/spree/products_controller_spec.rb
solidus_multi_domain-1.1.3 spec/controllers/spree/products_controller_spec.rb
solidus_multi_domain-1.1.2 spec/controllers/spree/products_controller_spec.rb
solidus_multi_domain-1.1.1 spec/controllers/spree/products_controller_spec.rb
solidus_multi_domain-1.0.3 spec/controllers/spree/products_controller_spec.rb
solidus_multi_domain-1.1.0 spec/controllers/spree/products_controller_spec.rb
solidus_multi_domain-1.0.1 spec/controllers/spree/products_controller_spec.rb
solidus_multi_domain-1.0.0 spec/controllers/spree/products_controller_spec.rb