Sha256: 60f18b6ef8cd0252bbb38ca3519b305e39991f97198649db452aef5c9a88f657
Contents?: true
Size: 1.01 KB
Versions: 2
Compression:
Stored size: 1.01 KB
Contents
RSpec.describe Spree::ProductsController, type: :controller do let!(:product) { create(:product, available_on: 1.year.from_now) } let!(:user) { build(:user, spree_api_key: 'fake') } it 'allows admins to view non-active products' do allow(controller).to receive(:before_save_new_order) allow(controller).to receive(:spree_current_user) { user } allow(user).to receive(:has_spree_role?) { true } get :show, params: { id: product.to_param } expect(response.status).to eq(200) end it 'cannot view non-active products' do allow(controller).to receive(:before_save_new_order) allow(controller).to receive(:spree_current_user) { user } allow(user).to receive(:has_spree_role?) { false } if SolidusSupport.solidus_gem_version < Gem::Version.new('2.5.x') get :show, params: { id: product.to_param } expect(response.status).to eq(404) else expect { get :show, params: { id: product.to_param } }.to raise_error(ActiveRecord::RecordNotFound) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
solidus_auth_devise-2.2.0 | spec/controllers/spree/products_controller_spec.rb |
solidus_auth_devise-2.1.0 | spec/controllers/spree/products_controller_spec.rb |