Sha256: a78282c606947831179b23da5b28918bd7d86e44e064fe9dc4b1e32542b10fc9
Contents?: true
Size: 752 Bytes
Versions: 2
Compression:
Stored size: 752 Bytes
Contents
require 'shell_mock/monkey_patch' require 'shell_mock/stub_registry' require 'shell_mock/no_stub_specified' module ShellMock class ExecMonkeyPatch < MonkeyPatch def method_name :exec end def override(env, command = nil, **options) env, command = {}, env if command.nil? # other arg manipulation can go here if necessary stub = StubRegistry.stub_matching(env, command, options) if stub stub.ran stub.side_effect.call __un_shell_mocked_exec(stub.to_oneliner) else if ShellMock.let_commands_run? __un_shell_mocked_exec(env, command, **options) else raise NoStubSpecified.new(env, command, options) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
shell_mock-0.7.0 | lib/shell_mock/exec_monkey_patch.rb |
shell_mock-0.6.0 | lib/shell_mock/exec_monkey_patch.rb |