Sha256: 5798147d324d752acd95559a67251c2d59ba52f237da0523e7abb019a143a32d

Contents?: true

Size: 551 Bytes

Versions: 9

Compression:

Stored size: 551 Bytes

Contents

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 = lambda {|a| a }
        expect(guard).to be_controller_available

        SwitchUser.controller_guard = lambda {|a| !a }
        expect(guard).not_to be_controller_available
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
switch_user-1.4.0 spec/switch_user/lambda_guard_spec.rb
switch_user-1.3.1 spec/switch_user/lambda_guard_spec.rb
switch_user-1.3.0 spec/switch_user/lambda_guard_spec.rb
switch_user-1.2.1 spec/switch_user/lambda_guard_spec.rb
switch_user-1.2.0 spec/switch_user/lambda_guard_spec.rb
switch_user-1.1.0 spec/switch_user/lambda_guard_spec.rb
switch_user-1.0.2 spec/switch_user/lambda_guard_spec.rb
switch_user-1.0.1 spec/switch_user/lambda_guard_spec.rb
switch_user-1.0.0 spec/switch_user/lambda_guard_spec.rb