class ShellMock::SpawnMonkeyPatch

Public Instance Methods

disable() click to toggle source
Calls superclass method ShellMock::MonkeyPatch#disable
# File lib/shell_mock/spawn_monkey_patch.rb, line 38
def disable
  super

  disable_for(Process.eigenclass) if Process.respond_to?(method_alias, true)
end
enable() click to toggle source
Calls superclass method ShellMock::MonkeyPatch#enable
# File lib/shell_mock/spawn_monkey_patch.rb, line 32
def enable
  enable_for(Process.eigenclass) unless Process.respond_to?(method_alias, true)

  super
end
method_name() click to toggle source
# File lib/shell_mock/spawn_monkey_patch.rb, line 8
def method_name
  :spawn
end
override(*args) click to toggle source
# File lib/shell_mock/spawn_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_spawn(stub.to_oneliner, options)
  else
    if ShellMock.let_commands_run?
      __un_shell_mocked_spawn(env, command, options)
    else
      raise NoStubSpecified.new(env, command, options)
    end
  end
end