Sha256: bb04c11690c8fea5fda064c0428a335ca745ba9f0ed3cd504207411e58cc1395

Contents?: true

Size: 1.14 KB

Versions: 8

Compression:

Stored size: 1.14 KB

Contents

require 'spec_helper'

RSpec.describe Hyrax::Admin::WorkflowRolesController, :no_clean do
  routes { Hyrax::Engine.routes }

  describe "#get" do
    context "when you have permission" do
      before do
        allow(controller).to receive(:authorize!).with(:read, :admin_dashboard).and_return(true)
      end

      it "is successful" do
        expect(controller).to receive(:add_breadcrumb).with('Home', root_path(locale: 'en'))
        expect(controller).to receive(:add_breadcrumb).with('Administration', Hyrax::Engine.routes.url_helpers.admin_path(locale: 'en'))
        expect(controller).to receive(:add_breadcrumb).with('Workflow Roles', Hyrax::Engine.routes.url_helpers.admin_workflow_roles_path(locale: 'en'))
        get :index
        expect(response).to be_success
        expect(assigns[:presenter]).to be_kind_of Hyrax::Admin::WorkflowRolesPresenter
        expect(response).to render_template('layouts/admin')
      end
    end

    context "when they don't have permission" do
      it "throws a CanCan error" do
        get :index
        expect(response).to redirect_to main_app.new_user_session_path(locale: 'en')
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
hyrax-1.1.1 spec/controllers/hyrax/admin/workflow_roles_controller_spec.rb
hyrax-1.1.0 spec/controllers/hyrax/admin/workflow_roles_controller_spec.rb
hyrax-1.0.5 spec/controllers/hyrax/admin/workflow_roles_controller_spec.rb
hyrax-1.0.4 spec/controllers/hyrax/admin/workflow_roles_controller_spec.rb
hyrax-1.0.3 spec/controllers/hyrax/admin/workflow_roles_controller_spec.rb
hyrax-1.0.2 spec/controllers/hyrax/admin/workflow_roles_controller_spec.rb
hyrax-1.0.1 spec/controllers/hyrax/admin/workflow_roles_controller_spec.rb
hyrax-1.0.0.rc2 spec/controllers/hyrax/admin/workflow_roles_controller_spec.rb