diff options
| author | mo khan <mo@mokhan.ca> | 2014-03-21 22:57:40 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2014-03-21 22:57:40 -0600 |
| commit | f6b096a65c3f5588c82047099ee3922be7573eb2 (patch) | |
| tree | 14af8f2e3e2f094c085d33308b23acb9f520c132 | |
| parent | e7a25c6b21a1ae5c714320b340617b2e263b4789 (diff) | |
chain infinite commands together.v0.0.1395464273main
| -rw-r--r-- | lib/nasty/composite_command.rb | 2 | ||||
| -rw-r--r-- | spec/unit/command_spec.rb | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/lib/nasty/composite_command.rb b/lib/nasty/composite_command.rb index 6b0c683..a1f5a90 100644 --- a/lib/nasty/composite_command.rb +++ b/lib/nasty/composite_command.rb @@ -1,5 +1,7 @@ module Nasty class CompositeCommand + include Command + def initialize(first, last) @first = first @last = last diff --git a/spec/unit/command_spec.rb b/spec/unit/command_spec.rb index a3eddf1..fc041d4 100644 --- a/spec/unit/command_spec.rb +++ b/spec/unit/command_spec.rb @@ -20,12 +20,13 @@ module Nasty context "without parameters" do let(:first_command) { SimpleCommand.new } let(:second_command) { SimpleCommand.new } + let(:third_command) { SimpleCommand.new } - it "chains two commands together" do - result = first_command.then(second_command) - result.run + it "chains multiple commands together" do + first_command.then(second_command).then(third_command).run first_command.ran?.should be_true second_command.ran?.should be_true + third_command.ran?.should be_true end end |
