Sha256: d14469486d132e67537679dc24537b4de4137288c3e363d539219bfc9cdfd7a4

Contents?: true

Size: 713 Bytes

Versions: 26

Compression:

Stored size: 713 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(: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

26 entries across 26 versions & 2 rubygems

Version Path
solidus_backend-2.6.6 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend-2.7.4 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend-2.7.3 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend-2.6.5 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend-2.7.2 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend-2.6.4 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend-2.6.3 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend-2.7.1 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend-2.6.2 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend_devise_token_auth-2.8.0.alpha.14 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend_devise_token_auth-2.8.0.alpha.13 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend_devise_token_auth-2.8.0.alpha.12 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend_devise_token_auth-2.8.0.alpha.11 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend_devise_token_auth-2.8.0.alpha.10 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend_devise_token_auth-2.8.0.alpha.9 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend_devise_token_auth-2.8.0.alpha.8 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend_devise_token_auth-2.8.0.alpha.7 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend_devise_token_auth-2.8.0.alpha.6 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend_devise_token_auth-2.8.0.alpha.5 spec/controllers/spree/admin/base_controller_spec.rb
solidus_backend_devise_token_auth-2.8.0.alpha.4 spec/controllers/spree/admin/base_controller_spec.rb