Skip to content
This repository
Browse code

Use has_role? not admin? to check for user admin ability in ProductsC…

…ontrollerDecorator

Fixes #1562
  • Loading branch information...
commit be3388d752a11999bdbf6f0f579c5c1b4bfc8e59 1 parent e38893b
Ryan Bigg radar authored

Showing 1 changed file with 7 additions and 0 deletions. Show diff stats Hide diff stats

  1. +7 0 core/spec/controllers/spree/products_controller_spec.rb
7 core/spec/controllers/spree/products_controller_spec.rb
@@ -2,9 +2,16 @@
2 2
3 3 describe Spree::ProductsController do
4 4 let!(:product) { create(:product, :available_on => 1.year.from_now) }
  5 + # Regression test for #1390
  6 + it "allows admins to view non-active products" do
  7 + controller.stub :current_user => stub(:has_role? => true)
  8 + get :show, :id => product.to_param
  9 + response.status.should == 200
  10 + end
5 11
6 12 # Regression test for #1390
7 13 it "cannot view non-active products" do
  14 + controller.stub :current_user => stub(:has_role? => false)
8 15 get :show, :id => product.to_param
9 16 response.status.should == 404
10 17 end

0 comments on commit be3388d

Please sign in to comment.
Something went wrong with that request. Please try again.