Sha256: 52febb0368547570632d6090b8b161764d1115a6f74fd3565247f9f8a7c4fc12
Contents?: true
Size: 1.74 KB
Versions: 32
Compression:
Stored size: 1.74 KB
Contents
require 'spec_helper' describe Spree::PermissionSets::RestrictedStockTransferDisplay do let(:ability) { Spree::Ability.new(user) } let(:user) { create :user } subject { ability } let!(:sl1) { create :stock_location, active: false } let!(:sl2) { create :stock_location, active: false } let!(:source_transfer) { create :stock_transfer, source_location: sl1 } let!(:other_source_transfer) { create :stock_transfer, source_location: sl2 } let!(:dest_transfer) { create :stock_transfer, source_location: sl2, destination_location: sl1 } before do user.stock_locations << sl1 end context "when activated" do before do described_class.new(ability).activate! end it { is_expected.to be_able_to(:display, sl1) } it { is_expected.to_not be_able_to(:display, sl2) } it { is_expected.to be_able_to(:display, source_transfer) } it { is_expected.to_not be_able_to(:display, other_source_transfer) } it { is_expected.to be_able_to(:display, dest_transfer) } it { is_expected.to be_able_to(:admin, source_transfer) } it { is_expected.to_not be_able_to(:admin, other_source_transfer) } it { is_expected.to be_able_to(:admin, dest_transfer) } end context "when not activated" do it { is_expected.to_not be_able_to(:display, sl1) } it { is_expected.to_not be_able_to(:display, sl2) } it { is_expected.to_not be_able_to(:display, source_transfer) } it { is_expected.to_not be_able_to(:display, other_source_transfer) } it { is_expected.to_not be_able_to(:display, dest_transfer) } it { is_expected.to_not be_able_to(:admin, source_transfer) } it { is_expected.to_not be_able_to(:admin, other_source_transfer) } it { is_expected.to_not be_able_to(:admin, dest_transfer) } end end
Version data entries
32 entries across 32 versions & 1 rubygems