Class: RSpec::Bash::Mocks::Matchers::TestBy

Inherits:
BaseMatcher
  • Object
show all
Defined in:
lib/rspec/bash/mocks/matchers/test_by.rb

Instance Attribute Summary

Attributes inherited from BaseMatcher

#double

Instance Method Summary collapse

Methods inherited from BaseMatcher

#and_always_return, #and_always_yield, #and_call_original, #and_return, #and_yield, #at_least, #at_most, #exactly, #matches?, #name, #never, #once, #setup_allowance, #thrice, #times, #twice

Constructor Details

#initialize(expr) ⇒ TestBy

Returns a new instance of TestBy.



10
11
12
13
14
15
# File 'lib/rspec/bash/mocks/matchers/test_by.rb', line 10

def initialize(expr)
  @double = Doubles::ConditionalDouble.new(expr)
  @display_name = "test_by"

  super()
end

Instance Method Details

#with_args(args) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/rspec/bash/mocks/matchers/test_by.rb', line 17

def with_args(args)
  tap {
    fullexpr = "#{@double.expr} #{args}"

    @double.expected_calls << fullexpr
    @double.behaviors << create_behavior(args: fullexpr)
  }
end