Skip to content

Commit

Permalink
Fix group price specs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Dutil committed Jan 31, 2014
1 parent 223dcdc commit 4c7b95a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
\#*
*~
.#*
.bundle
.DS_Store
.idea
.project
Expand Down
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ group :development, :test do
gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: '2-1-stable'
gem 'spree_digital', github: 'halo/spree_digital', branch: '2-1-stable'
gem 'spree_editor', github: 'spree/spree_editor'
# gem 'spree_group_pricing', github: 'jdutil/spree_group_pricing'
gem 'spree_related_products', github: 'spree/spree_related_products', branch: '2-1-stable'
end

Expand Down
21 changes: 12 additions & 9 deletions spec/models/spree/supplier_ability_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,20 @@
end
end

context 'for GroupPricing' do
let(:resource) { Spree::GroupPrice.new }
# GroupPrice extension was used in a 2.0.x application, and may not be updated for newer version but leaving code for now in case it is.
if defined?(Spree::GroupPrice)
context 'for GroupPricing' do
let(:resource) { Spree::GroupPrice.new }

context 'requested by another suppliers user' do
let(:resource) { Spree::GroupPrice.new({variant: create(:variant, product: create(:product, supplier: create(:supplier)))}, without_protection: true) }
it_should_behave_like 'access denied'
end
context 'requested by another suppliers user' do
let(:resource) { Spree::GroupPrice.new({variant: create(:variant, product: create(:product, supplier: create(:supplier)))}, without_protection: true) }
it_should_behave_like 'access denied'
end

context 'requested by suppliers user' do
let(:resource) { Spree::GroupPrice.new({variant: create(:variant, product: create(:product, supplier: user.supplier))}, without_protection: true) }
it_should_behave_like 'access granted'
context 'requested by suppliers user' do
let(:resource) { Spree::GroupPrice.new({variant: create(:variant, product: create(:product, supplier: user.supplier))}, without_protection: true) }
it_should_behave_like 'access granted'
end
end
end

Expand Down

0 comments on commit 4c7b95a

Please sign in to comment.