Sha256: 1d1b2aef9e516ca142ff9653971c29e2795cdc28437cdeb84986e95151580f6c
Contents?: true
Size: 991 Bytes
Versions: 12
Compression:
Stored size: 991 Bytes
Contents
# frozen_string_literal: true module Decidim module WardenTestHelpers include Warden::Test::Helpers # # Utility method to login in the middle of a test as a different user from # the current one. # def relogin_as(user, scope: :user) logout scope login_as user, scope: scope end end end RSpec.configure do |config| config.include Decidim::WardenTestHelpers, type: :system config.include Decidim::WardenTestHelpers, type: :request config.include Devise::Test::ControllerHelpers, type: :controller config.before :each, type: :cell do if controller allow(controller).to receive(:current_organization).and_return(try(:organization) || try(:current_organization) || nil) allow(controller).to receive(:current_user).and_return(try(:user) || try(:current_user) || nil) end end config.after :each, type: :system do Warden.test_reset! end config.after :each, type: :request do Warden.test_reset! end end
Version data entries
12 entries across 12 versions & 1 rubygems