Sha256: 722d28200cbed183cb6b025f8f5d2a793a2c6b43f478a9be00894ae6139fd741
Contents?: true
Size: 966 Bytes
Versions: 2
Compression:
Stored size: 966 Bytes
Contents
require 'shell_mock/monkey_patch' require 'shell_mock/stub_registry' require 'shell_mock/no_stub_specified' require 'shell_mock/spawn_arguments' module ShellMock class SpawnMonkeyPatch < MonkeyPatch def method_name :spawn end 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 def enable enable_for(Process.eigenclass) unless Process.respond_to?(method_alias, true) super end def disable super disable_for(Process.eigenclass) if Process.respond_to?(method_alias, true) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
shell_mock-0.7.2 | lib/shell_mock/spawn_monkey_patch.rb |
shell_mock-0.7.1 | lib/shell_mock/spawn_monkey_patch.rb |