Module: ShellMock
- Defined in:
- lib/shell_mock.rb,
lib/shell_mock/version.rb,
lib/shell_mock/command_stub.rb,
lib/shell_mock/monkey_patch.rb,
lib/shell_mock/run_verifier.rb,
lib/shell_mock/stub_registry.rb,
lib/shell_mock/rspec/matchers.rb,
lib/shell_mock/exec_monkey_patch.rb,
lib/shell_mock/no_stub_specified.rb,
lib/shell_mock/spawn_monkey_patch.rb,
lib/shell_mock/system_monkey_patch.rb,
lib/shell_mock/backtick_monkey_patch.rb
Defined Under Namespace
Modules: Matchers
Classes: BacktickMonkeyPatch, CommandStub, ExecMonkeyPatch, MonkeyPatch, NoStubSpecified, RunVerifier, SpawnMonkeyPatch, SystemMonkeyPatch
Constant Summary
collapse
- VERSION =
"0.7.1"
- StubRegistry =
Object.new
Class Method Summary
collapse
Class Method Details
.disable ⇒ Object
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/shell_mock.rb', line 41
def self.disable
ShellMock.monkey_patches.each(&:disable)
StubRegistry.clear
@enabled = false
@let_commands_run = nil
true
end
|
.dont_let_commands_run ⇒ Object
19
20
21
|
# File 'lib/shell_mock.rb', line 19
def self.dont_let_commands_run
@let_commands_run = false
end
|
.dont_let_commands_run? ⇒ Boolean
smell; this is a mistake of a method that will only confuse people
29
30
31
|
# File 'lib/shell_mock.rb', line 29
def self.dont_let_commands_run?
!let_commands_run?
end
|
.enable ⇒ Object
33
34
35
36
37
38
39
|
# File 'lib/shell_mock.rb', line 33
def self.enable
ShellMock.monkey_patches.each(&:enable)
@enabled = true
true
end
|
.enabled? ⇒ Boolean
52
53
54
|
# File 'lib/shell_mock.rb', line 52
def self.enabled?
@enabled
end
|
.let_commands_run ⇒ Object
15
16
17
|
# File 'lib/shell_mock.rb', line 15
def self.let_commands_run
@let_commands_run = true
end
|
.let_commands_run? ⇒ Boolean
23
24
25
26
|
# File 'lib/shell_mock.rb', line 23
def self.let_commands_run?
@let_commands_run = true if @let_commands_run.nil?
@let_commands_run
end
|
.stub_command(command) ⇒ Object
9
10
11
12
13
|
# File 'lib/shell_mock.rb', line 9
def self.stub_command(command)
command_stub = CommandStub.new(command)
StubRegistry.register_command_stub(command_stub)
end
|