Skip to content

Commit

Permalink
Move CanCan-specific rescuing out from core into auth where it belongs.
Browse files Browse the repository at this point in the history
Fixes spree#1262. h/t @citrus
  • Loading branch information
radar committed Mar 12, 2012
1 parent 44d5a5b commit 872ace8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Spree::Admin::ResourceController.class_eval do
rescue_from CanCan::AccessDenied, :with => :unauthorized
end
1 change: 0 additions & 1 deletion core/app/controllers/spree/admin/resource_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ class Spree::Admin::ResourceController < Spree::Admin::BaseController
helper_method :new_object_url, :edit_object_url, :object_url, :collection_url
prepend_before_filter :load_resource
rescue_from ActiveRecord::RecordNotFound, :with => :resource_not_found
rescue_from CanCan::AccessDenied, :with => :unauthorized

respond_to :html
respond_to :js, :except => [:show, :index]
Expand Down
7 changes: 0 additions & 7 deletions core/spec/requests/admin/products/products_spec.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
require 'spec_helper'

describe "Products" do
context "as anonymous user" do
# regression test for #1250
it "is redirected to login page when attempting to access product listing" do
lambda { visit spree.admin_products_path }.should_not raise_error
end
end

context "as admin user" do
before(:each) do
sign_in_as!(Factory(:admin_user))
Expand Down

0 comments on commit 872ace8

Please sign in to comment.