core: just don't use ** to avoid symbol/strings mixup

/cc @sethvargo
This commit is contained in:
Mitchell Hashimoto 2015-01-05 12:37:58 -08:00
parent c4502737c8
commit 6aeae27889
2 changed files with 15 additions and 2 deletions

View File

@ -150,9 +150,11 @@ module Vagrant
# @param [Hash] extra_env This data will be passed into the action runner
# as extra data set on the environment hash for the middleware
# runner.
def action(name, **opts)
def action(name, opts=nil)
@logger.info("Calling action: #{name} on provider #{@provider}")
opts ||= {}
# Determine whether we lock or not
lock = true
lock = opts.delete(:lock) if opts.has_key?(:lock)

View File

@ -252,13 +252,24 @@ describe Vagrant::Machine do
expect(machine).to eql(instance)
end
it "should pass any extra options to the environment" do
action_name = :up
foo = nil
callable = lambda { |env| foo = env[:foo] }
allow(provider).to receive(:action).with(action_name).and_return(callable)
instance.action(:up, foo: :bar)
expect(foo).to eq(:bar)
end
it "should pass any extra options to the environment as strings" do
action_name = :up
foo = nil
callable = lambda { |env| foo = env["foo"] }
allow(provider).to receive(:action).with(action_name).and_return(callable)
instance.action(:up, foo: :bar)
instance.action(:up, "foo" => :bar)
expect(foo).to eq(:bar)
end