From 086ca5a97ecf65508b01ea9969c436a74874a451 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 7 Jul 2010 21:00:54 -0700 Subject: [PATCH] Builder#use returns self, for chaining --- lib/vagrant/action/builder.rb | 2 ++ test/vagrant/action/builder_test.rb | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/lib/vagrant/action/builder.rb b/lib/vagrant/action/builder.rb index 47a3226d7..7873e9ecc 100644 --- a/lib/vagrant/action/builder.rb +++ b/lib/vagrant/action/builder.rb @@ -52,6 +52,8 @@ module Vagrant else self.stack << [middleware, args, block] end + + self end # Inserts a middleware at the given index or directly before the diff --git a/test/vagrant/action/builder_test.rb b/test/vagrant/action/builder_test.rb index b75f35b80..e4c1dc17c 100644 --- a/test/vagrant/action/builder_test.rb +++ b/test/vagrant/action/builder_test.rb @@ -28,6 +28,10 @@ class ActionBuilderTest < Test::Unit::TestCase end context "adding to the stack" do + should "return self" do + assert @instance.equal?(@instance.use(1)) + end + should "add to the end" do @instance.use 1 @instance.use 2