Sha256: a0b0c3cceaca5930845874a309911facae40c1ec7d0d1a760c37ce12727c115d

Contents?: true

Size: 577 Bytes

Versions: 9

Compression:

Stored size: 577 Bytes

Contents

module Alchemy
  module TestSupport

    # Helpers for authentication
    #
    module AuthHelpers

      def sign_in(user = admin_user)
        controller.stub current_alchemy_user: 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

9 entries across 9 versions & 1 rubygems

Version Path
alchemy_cms-3.0.4 lib/alchemy/test_support/auth_helpers.rb
alchemy_cms-3.0.3 lib/alchemy/test_support/auth_helpers.rb
alchemy_cms-3.0.2 lib/alchemy/test_support/auth_helpers.rb
alchemy_cms-3.0.1 lib/alchemy/test_support/auth_helpers.rb
alchemy_cms-3.0.0 lib/alchemy/test_support/auth_helpers.rb
alchemy_cms-3.0.0.rc8 lib/alchemy/test_support/auth_helpers.rb
alchemy_cms-3.0.0.rc7 lib/alchemy/test_support/auth_helpers.rb
alchemy_cms-3.0.0.rc6 lib/alchemy/test_support/auth_helpers.rb
alchemy_cms-3.0.0.rc5 lib/alchemy/test_support/auth_helpers.rb