Sha256: 26abf09733ed959982d83d439f1bc5d8a32063d7906f0e9e89b168b79a7c2851

Contents?: true

Size: 681 Bytes

Versions: 11

Compression:

Stored size: 681 Bytes

Contents

# Spree's rpsec controller tests get the Spree::ControllerHacks
# we don't need those for the anonymous controller here, so
# we call process directly instead of get
require 'spec_helper'

describe Spree::Admin::BaseController, type: :controller do
  controller(Spree::Admin::BaseController) do
    def index
      authorize! :update, Spree::Order
      render text: 'test'
    end
  end

  context "unauthorized request" do
    before do
      allow_any_instance_of(Spree::Admin::BaseController).to receive(:spree_current_user).and_return(nil)
    end

    it "redirects to unauthorized" do
      get :index
      expect(response).to redirect_to '/unauthorized'
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
solidus_backend-1.4.2 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend-1.3.2 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend-1.4.1 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend-1.4.0 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend-1.4.0.rc1 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend-1.4.0.beta1 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend-1.3.1 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend-1.3.0 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend-1.3.0.rc2 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend-1.3.0.rc1 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend-1.3.0.beta1 spec/controllers/spree/admin/base_controller_spec.rb