class Rspec::Shell::Expectations::CallLog

Log of calls to a command

Public Class Methods

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

Public Instance Methods

called_with_args?(*args) click to toggle source
# File lib/rspec/shell/expectations/call_log.rb, line 14
def called_with_args?(*args)
  return true if find_call(*args)
  false
end
exist?() click to toggle source
# File lib/rspec/shell/expectations/call_log.rb, line 10
def exist?
  @call_log_path.exist?
end
stdin_for_args(*args) click to toggle source
# File lib/rspec/shell/expectations/call_log.rb, line 19
def stdin_for_args(*args)
  call = find_call(*args)
  return call['stdin'] if call
  nil
end

Private Instance Methods

call_log() click to toggle source
# File lib/rspec/shell/expectations/call_log.rb, line 35
def call_log
  YAML.load_file @call_log_path
end
find_call(*args) click to toggle source
# File lib/rspec/shell/expectations/call_log.rb, line 27
def find_call(*args)
  call_log.each do |call|
    call_args = call['args'] || []
    return call if (args - call_args).empty?
  end
  nil
end