class ShellMock::SystemMonkeyPatch

Public Instance Methods

method_name() click to toggle source
# File lib/shell_mock/system_monkey_patch.rb, line 8
def method_name
  :system
end
override(*args) click to toggle source
# File lib/shell_mock/system_monkey_patch.rb, line 12
def override(*args)
  env, command, options = SpawnArguments(*args)

  stub = StubRegistry.stub_matching(env, command, options)

  if stub
    stub.ran

    stub.side_effect.call

    __un_shell_mocked_system(stub.to_oneliner)
  else
    if ShellMock.let_commands_run?
      __un_shell_mocked_system(env, command, options)
    else
      raise NoStubSpecified.new(env, command, options)
    end
  end
end