Permalink
Browse files

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

…ontrollerDecorator


Fixes #1562
  • Loading branch information...
radar committed May 21, 2012
1 parent e38893b commit be3388d752a11999bdbf6f0f579c5c1b4bfc8e59
Showing with 7 additions and 0 deletions.
  1. +7 −0 core/spec/controllers/spree/products_controller_spec.rb
@@ -2,9 +2,16 @@
describe Spree::ProductsController do
let!(:product) { create(:product, :available_on => 1.year.from_now) }
+ # Regression test for #1390
+ it "allows admins to view non-active products" do
+ controller.stub :current_user => stub(:has_role? => true)
+ get :show, :id => product.to_param
+ response.status.should == 200
+ end
# Regression test for #1390
it "cannot view non-active products" do
+ controller.stub :current_user => stub(:has_role? => false)
get :show, :id => product.to_param
response.status.should == 404
end

0 comments on commit be3388d

Please sign in to comment.