core: installing a plugin from a gem doesn't constrain it

This commit is contained in:
Mitchell Hashimoto 2014-01-07 13:56:51 -08:00
parent ba85627c21
commit 3f4058471c
2 changed files with 25 additions and 1 deletions

View File

@ -34,7 +34,7 @@ module Vagrant
# If this is a gem file, then we install that gem locally.
local_spec = Vagrant::Bundler.instance.install_local(name)
name = local_spec.name
opts[:version] = "= #{local_spec.version}"
opts[:version] = local_spec.version.to_s
local = true
end

View File

@ -60,6 +60,30 @@ describe Vagrant::Plugin::Manager do
to raise_error(Vagrant::Errors::BundlerError)
end
it "can install a local gem" do
name = "foo.gem"
version = "1.0"
local_spec = Gem::Specification.new
local_spec.name = "bar"
local_spec.version = version
bundler.should_receive(:install_local).with(name).
ordered.and_return(local_spec)
bundler.should_receive(:install).once.with do |plugins, local|
expect(plugins).to have_key("bar")
expect(plugins["bar"]["gem_version"]).to eql("#{version}")
expect(local).to be_true
end.ordered.and_return([local_spec])
subject.install_plugin(name)
plugins = subject.installed_plugins
expect(plugins).to have_key("bar")
expect(plugins["bar"]["gem_version"]).to eql("")
end
describe "installation options" do
let(:specs) do
specs = Array.new(5) { Gem::Specification.new }