Sha256: 5bddd0eaeef974ae236f02077cb8951956d4f254fb27c534f07560e3741f2241

Contents?: true

Size: 717 Bytes

Versions: 21

Compression:

Stored size: 717 Bytes

Contents

# frozen_string_literal: true

# 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 plain: 'test'
    end
  end

  context "unauthorized request" do
    before do
      allow_any_instance_of(Spree::Admin::BaseController).to receive(:try_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

21 entries across 21 versions & 1 rubygems

Version Path
solidus_backend-2.10.5 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend-2.10.3 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend-2.10.2 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend-2.9.6 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend-2.8.6 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend-2.10.1 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend-2.9.5 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend-2.10.0 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend-2.9.4 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend-2.8.5 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend-2.9.3 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend-2.9.2 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend-2.10.0.beta1 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend-2.9.1 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend-2.9.0 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend-2.9.0.rc.1 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend-2.8.4 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend-2.8.3 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend-2.8.2 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend-2.8.1 spec/controllers/spree/admin/base_controller_spec.rb