class RSpec::Bash::StubBehavior

Attributes

args[RW]
body[RW]

Public Class Methods

new(args: nil, body:, charges: 1, subshell: true) click to toggle source
# File lib/rspec/bash/stub_behavior.rb, line 6
def initialize(args: nil, body:, charges: 1, subshell: true)
  @args = args
  @body = body
  @subshell = subshell
  @charges = charges
end

Public Instance Methods

applicable?(args) click to toggle source
# File lib/rspec/bash/stub_behavior.rb, line 17
def applicable?(args)
  @args == args
end
apply!(args) click to toggle source
# File lib/rspec/bash/stub_behavior.rb, line 29
def apply!(args)
  @charges -= 1
  @body.call(args)
end
context_free?() click to toggle source
# File lib/rspec/bash/stub_behavior.rb, line 21
def context_free?
  @args.nil?
end
requires_subshell?() click to toggle source
# File lib/rspec/bash/stub_behavior.rb, line 25
def requires_subshell?
  @subshell
end
usable?() click to toggle source
# File lib/rspec/bash/stub_behavior.rb, line 13
def usable?
  @charges > 0
end