Class: RSpec::Bash::Mocks::Doubles::FunctionDouble
Instance Attribute Summary
#behaviors, #call_original, #calls, #expected_call_count, #expected_calls, #subshell
Instance Method Summary
collapse
Constructor Details
Returns a new instance of FunctionDouble.
6
7
8
9
10
|
# File 'lib/rspec/bash/mocks/doubles/function_double.rb', line 6
def initialize(routine)
super()
@routine = routine
end
|
Instance Method Details
#apply(script) ⇒ Object
12
13
14
15
16
17
18
|
# File 'lib/rspec/bash/mocks/doubles/function_double.rb', line 12
def apply(script)
script.stub(@routine,
call_original: call_original,
behaviors: behaviors,
subshell: subshell,
)
end
|
#call_args(script) ⇒ Object
24
25
26
|
# File 'lib/rspec/bash/mocks/doubles/function_double.rb', line 24
def call_args(script)
script.calls_for(@routine).map { |x| x[:args] }
end
|
#call_count(script) ⇒ Object
20
21
22
|
# File 'lib/rspec/bash/mocks/doubles/function_double.rb', line 20
def call_count(script)
script.calls_for(@routine).count
end
|
#to_s ⇒ Object
28
29
30
|
# File 'lib/rspec/bash/mocks/doubles/function_double.rb', line 28
def to_s
@routine.to_s
end
|