Commit f6b096a

mo khan <mo@mokhan.ca>
2014-03-22 04:57:40
chain infinite commands together. tag: v0.0.1395464273 main
1 parent e7a25c6
Changed files (2)
lib/nasty/composite_command.rb
@@ -1,5 +1,7 @@
 module Nasty
   class CompositeCommand
+    include Command
+
     def initialize(first, last)
       @first = first
       @last = last
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