Module: Dk::HasTheStubs::InstanceMethods
- Defined in:
- lib/dk/has_the_stubs.rb
Instance Method Summary collapse
-
#local_cmd_stubs ⇒ Object
cmd stub api.
-
#remote_cmd_stubs ⇒ Object
ssh stub API.
- #stub_cmd(cmd_str, args = nil, &block) ⇒ Object
- #stub_ssh(cmd_str, args = nil, &block) ⇒ Object
- #unstub_all_cmds ⇒ Object
- #unstub_all_ssh ⇒ Object
Instance Method Details
#local_cmd_stubs ⇒ Object
cmd stub api
19 20 21 |
# File 'lib/dk/has_the_stubs.rb', line 19 def local_cmd_stubs @local_cmd_stubs ||= [] end |
#remote_cmd_stubs ⇒ Object
ssh stub API
41 42 43 |
# File 'lib/dk/has_the_stubs.rb', line 41 def remote_cmd_stubs @remote_cmd_stubs ||= [] end |
#stub_cmd(cmd_str, args = nil, &block) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/dk/has_the_stubs.rb', line 23 def stub_cmd(cmd_str, args = nil, &block) args ||= {} cmd_str_proc = get_cmd_ssh_proc(cmd_str) input_proc = get_cmd_ssh_proc(args[:input]) given_opts_proc = get_cmd_ssh_proc(args[:opts]) local_cmd_stubs.unshift( Stub.new(cmd_str_proc, input_proc, given_opts_proc, block) ) end |
#stub_ssh(cmd_str, args = nil, &block) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/dk/has_the_stubs.rb', line 45 def stub_ssh(cmd_str, args = nil, &block) args ||= {} cmd_str_proc = get_cmd_ssh_proc(cmd_str) input_proc = get_cmd_ssh_proc(args[:input]) given_opts_proc = get_cmd_ssh_proc(args[:opts]) remote_cmd_stubs.unshift( Stub.new(cmd_str_proc, input_proc, given_opts_proc, block) ) end |
#unstub_all_cmds ⇒ Object
35 36 37 |
# File 'lib/dk/has_the_stubs.rb', line 35 def unstub_all_cmds local_cmd_stubs.clear end |
#unstub_all_ssh ⇒ Object
57 58 59 |
# File 'lib/dk/has_the_stubs.rb', line 57 def unstub_all_ssh remote_cmd_stubs.clear end |