Sha256: 33e117c8e03701983449d6889396751a7229ae623a447df8d43e90d2e6c0b89c

Contents?: true

Size: 1.21 KB

Versions: 3

Compression:

Stored size: 1.21 KB

Contents

module Refinery
  module Testing
    module ControllerMacros
      module Authentication
        def self.extended(base)
          base.send(:include, Devise::TestHelpers)
        end

        def login_user
          before(:each) do
            @user = FactoryGirl.create(:user)
            @request.env["devise.mapping"] = Devise.mappings[:admin]
            sign_in @user
          end
        end

        def login_refinery_user
          before(:each) do
            @refinery_user = FactoryGirl.create(:refinery_user)
            @request.env["devise.mapping"] = Devise.mappings[:admin]
            sign_in @refinery_user
          end
        end

        def login_refinery_superuser
          before(:each) do
            @refinery_superuser = FactoryGirl.create(:refinery_superuser)
            @request.env["devise.mapping"] = Devise.mappings[:admin]
            sign_in @refinery_superuser
          end
        end

        def login_refinery_translator
          before(:each) do
            @refinery_translator = FactoryGirl.create(:refinery_translator)
            @request.env["devise.mapping"] = Devise.mappings[:admin]
            sign_in @refinery_translator
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
refinerycms-testing-2.0.2 lib/refinery/testing/controller_macros/authentication.rb
refinerycms-testing-2.0.1 lib/refinery/testing/controller_macros/authentication.rb
refinerycms-testing-2.0.0 lib/refinery/testing/controller_macros/authentication.rb