Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Update ability_spec.rb

Damian Legawiec1fe455ddbf51
diff --git a/core/spec/models/spree/ability_spec.rb b/core/spec/models/spree/ability_spec.rb
index 2cc95a1759..de68527ba9 100644
--- a/core/spec/models/spree/ability_spec.rb
+++ b/core/spec/models/spree/ability_spec.rb
@@ -59,7 +59,8 @@ describe Spree::Ability, type: :model do
context 'with admin user' do
before do
allow(user).to receive(:persisted?).and_return(true)
- allow(user).to receive(:has_spree_role?).and_return(true)
+ allow(user).to receive(:spree_roles).and_return(Spree::Role.where(name: 'admin'))
+ allow(user).to receive(:spree_admin?).and_return(true)
end
it_behaves_like 'access granted'
@@ -85,6 +86,7 @@ describe Spree::Ability, type: :model do
context 'admin user role' do
it 'is able to admin' do
allow(user).to receive(:persisted?).and_return(true)
+ allow(user).to receive(:spree_roles).and_return(Spree::Role.where(name: 'admin'))
allow(user).to receive(:spree_admin?).and_return(true)
expect(ability).to be_able_to :admin, resource
expect(ability).to be_able_to :index, resource_order
@@ -105,6 +107,7 @@ describe Spree::Ability, type: :model do
it 'is able to admin' do
allow(user).to receive(:persisted?).and_return(true)
+ allow(user).to receive(:spree_roles).and_return(Spree::Role.where(name: 'admin'))
allow(user).to receive(:spree_admin?).and_return(true)
expect(ability).to be_able_to :admin, resource
expect(ability).to be_able_to :index, resource_order