From 4d7d47086fada3b033e3be23382ab71ad5429f11 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 19 Dec 2013 08:02:54 -0800 Subject: [PATCH] core: configure version can be an int [GH-2689] --- CHANGELOG.md | 2 ++ lib/vagrant/config.rb | 2 +- test/unit/vagrant/config_test.rb | 25 +++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 46ffe72a5..9fc02bb33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ ## 1.4.2 (unreleased) +BUG FIXES: + - core: The version for `Vagrant.configure` can now be an int. [GH-2689] ## 1.4.1 (December 18, 2013) diff --git a/lib/vagrant/config.rb b/lib/vagrant/config.rb index 7d4b4db6a..2c9fe970d 100644 --- a/lib/vagrant/config.rb +++ b/lib/vagrant/config.rb @@ -35,7 +35,7 @@ module Vagrant def self.run(version="1", &block) # Store it for later @last_procs ||= [] - @last_procs << [version, block] + @last_procs << [version.to_s, block] end # This is a method which will yield to a block and will capture all diff --git a/test/unit/vagrant/config_test.rb b/test/unit/vagrant/config_test.rb index aa90fdf77..28f35f1f2 100644 --- a/test/unit/vagrant/config_test.rb +++ b/test/unit/vagrant/config_test.rb @@ -32,6 +32,31 @@ describe Vagrant::Config do procs[1][1].call end + it "should work with integer configurations "do + receiver = double() + + procs = described_class.capture_configures do + Vagrant.configure(1) do + receiver.one + end + + Vagrant.configure(2) do + receiver.two + end + end + + procs.should be_kind_of(Array) + procs.length.should == 2 + procs[0][0].should == "1" + procs[1][0].should == "2" + + # Verify the proper procs were captured + receiver.should_receive(:one).once.ordered + receiver.should_receive(:two).once.ordered + procs[0][1].call + procs[1][1].call + end + it "should capture configuration procs" do receiver = double()