Sha256: 7007ff99693634196428d9921a7e67d398a5d9069d56599e7c72797285367126

Contents?: true

Size: 574 Bytes

Versions: 4

Compression:

Stored size: 574 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

module SwitchUser
  RSpec.describe LambdaGuard do
    describe '#controller_available?' do
      it 'calls the controller_guard proc' do
        controller = double.as_null_object
        provider = double.as_null_object
        guard = SwitchUser::LambdaGuard.new(controller, provider)

        SwitchUser.controller_guard = ->(a) { a }
        expect(guard).to be_controller_available

        SwitchUser.controller_guard = ->(a) { !a }
        expect(guard).not_to be_controller_available
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
switch_user-1.5.4 spec/switch_user/lambda_guard_spec.rb
switch_user-1.5.3 spec/switch_user/lambda_guard_spec.rb
switch_user-1.5.2 spec/switch_user/lambda_guard_spec.rb
switch_user-1.5.1 spec/switch_user/lambda_guard_spec.rb