Sha256: 299e9cc5b02dadecc4eb3409927e632818aecc53fe0a4f8c043781701405ac26
Contents?: true
Size: 870 Bytes
Versions: 7
Compression:
Stored size: 870 Bytes
Contents
# frozen_string_literal: true RSpec.describe Macros::Auth::SignOut do include Warden::Test::Mock subject(:sign_out_step) { described_class.new } let(:user) { mock_model('User') } let(:scope) { :user } let(:ctx) { { warden: warden } } before do fake_class = Class.new dm = stub_const('Devise::Mapping', fake_class, transfer_nested_constants: true) allow(dm).to receive(:find_scope!).with(scope).and_return(scope) end context 'user signed in' do before do warden.set_user(user, scope: scope) end it 'expects to sign out user' do sign_out_step.call(ctx, warden: warden) expect(ctx[:current_user]).to be nil end end context 'user not signed in' do it 'expects to keep user signed out' do sign_out_step.call(ctx, warden: warden) expect(ctx[:current_user]).to be nil end end end
Version data entries
7 entries across 7 versions & 1 rubygems