Merge pull request #5218 from mbrodala/patch-1

Check plugin name with version spec in has_plugin
This commit is contained in:
Seth Vargo 2015-01-20 11:24:11 -05:00
commit 6783267e8e
2 changed files with 3 additions and 2 deletions

View File

@ -156,7 +156,7 @@ module Vagrant
Plugin::Manager.instance.installed_specs.any? do |s|
match = s.name == name
next match if !version
next version.satisfied_by?(s.version)
next match && version.satisfied_by?(s.version)
end
end

View File

@ -75,7 +75,7 @@ describe Vagrant do
expect(described_class.has_plugin?("bar")).to be_false
end
it "finds plugins by gem version" do
it "finds plugins by gem name and version" do
specs = [Gem::Specification.new]
specs[0].name = "foo"
specs[0].version = "1.2.3"
@ -83,6 +83,7 @@ describe Vagrant do
expect(described_class.has_plugin?("foo", "~> 1.2.0")).to be_true
expect(described_class.has_plugin?("foo", "~> 1.0.0")).to be_false
expect(described_class.has_plugin?("bar", "~> 1.2.0")).to be_false
end
end