Module: Mattock::CommandLineExampleGroup
- Includes:
- Matchers
- Defined in:
- lib/mattock/testing/mock-command-line.rb
Defined Under Namespace
Modules: Matchers
Class Method Summary (collapse)
Instance Method Summary (collapse)
Class Method Details
+ (Object) included(group)
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/mattock/testing/mock-command-line.rb', line 28 def self.included(group) group.class_eval do let :pairs do [] end before :each do Mattock::CommandLine.should_receive(:execute) do |cmd| pattern, res = pairs.shift pattern =~ cmd Mattock::MockCommandResult.create(*res) end.any_number_of_times end after :each do pairs.should have_all_been_called end end end |
Instance Method Details
- (Object) expect_command(cmd, *result)
48 49 50 |
# File 'lib/mattock/testing/mock-command-line.rb', line 48 def expect_command(cmd, *result) pairs << [cmd, result] end |