class Rspec::Shell::Expectations::StubbedCall

A specific call with arguments on a StubbedCommand

Public Class Methods

new(config, call_log, args) click to toggle source
# File lib/rspec/shell/expectations/stubbed_call.rb, line 6
def initialize(config, call_log, args)
  @config, @call_log, @args = config, call_log, args
end

Public Instance Methods

called?() click to toggle source
# File lib/rspec/shell/expectations/stubbed_call.rb, line 31
def called?
  return false unless @call_log.exist?
  @call_log.called_with_args?(*@args)
end
inspect() click to toggle source
# File lib/rspec/shell/expectations/stubbed_call.rb, line 36
def inspect
  if @args.any?
    "<Stubbed #{@config.command.inspect} " \
      "args: #{@args.join(' ').inspect}>"
  else
    "<Stubbed #{@config.command.inspect}>"
  end
end
outputs(content, to: :stdout) click to toggle source
# File lib/rspec/shell/expectations/stubbed_call.rb, line 20
def outputs(content, to: :stdout)
  @config.set_output(content, to, @args)
  @config.write
  self
end
returns_exitstatus(statuscode) click to toggle source
# File lib/rspec/shell/expectations/stubbed_call.rb, line 14
def returns_exitstatus(statuscode)
  @config.set_exitcode(statuscode, @args)
  @config.write
  self
end
stdin() click to toggle source
# File lib/rspec/shell/expectations/stubbed_call.rb, line 26
def stdin
  return nil unless @call_log.exist?
  @call_log.stdin_for_args(*@args)
end
with_args(*args) click to toggle source
# File lib/rspec/shell/expectations/stubbed_call.rb, line 10
def with_args(*args)
  StubbedCall.new(@config, @call_log, @args + args)
end