Sha256: 7b7912958611f23e4876a525703b8d5a29533094492212340cfa0741c4b10cc1

Contents?: true

Size: 602 Bytes

Versions: 13

Compression:

Stored size: 602 Bytes

Contents

module Alchemy
  module TestSupport

    # Helpers for authentication
    #
    module AuthHelpers

      def sign_in(user = admin_user)
        allow(controller).to receive(:current_alchemy_user).and_return user
      end

      def member_user
        mock_user([:member])
      end

      def author_user
        mock_user([:author])
      end

      def editor_user
        mock_user([:editor])
      end

      def admin_user
        mock_user([:admin])
      end

      def mock_user(roles)
        mock_model(Alchemy.user_class, alchemy_roles: roles.map(&:to_sym))
      end

    end

  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
alchemy_cms-3.1.3 lib/alchemy/test_support/auth_helpers.rb
alchemy_cms-3.2.0.beta lib/alchemy/test_support/auth_helpers.rb
alchemy_cms-3.1.1 lib/alchemy/test_support/auth_helpers.rb
alchemy_cms-3.1.0 lib/alchemy/test_support/auth_helpers.rb
alchemy_cms-3.1.0.rc3 lib/alchemy/test_support/auth_helpers.rb
alchemy_cms-3.1.0.rc2 lib/alchemy/test_support/auth_helpers.rb
alchemy_cms-3.1.0.rc1 lib/alchemy/test_support/auth_helpers.rb
alchemy_cms-3.1.0.beta6 lib/alchemy/test_support/auth_helpers.rb
alchemy_cms-3.1.0.beta5 lib/alchemy/test_support/auth_helpers.rb
alchemy_cms-3.1.0.beta4 lib/alchemy/test_support/auth_helpers.rb
alchemy_cms-3.1.0.beta3 lib/alchemy/test_support/auth_helpers.rb
alchemy_cms-3.1.0.beta2 lib/alchemy/test_support/auth_helpers.rb
alchemy_cms-3.1.0.beta1 lib/alchemy/test_support/auth_helpers.rb