Merge pull request #5218 from mbrodala/patch-1
Check plugin name with version spec in has_plugin
This commit is contained in:
commit
6783267e8e
|
@ -156,7 +156,7 @@ module Vagrant
|
||||||
Plugin::Manager.instance.installed_specs.any? do |s|
|
Plugin::Manager.instance.installed_specs.any? do |s|
|
||||||
match = s.name == name
|
match = s.name == name
|
||||||
next match if !version
|
next match if !version
|
||||||
next version.satisfied_by?(s.version)
|
next match && version.satisfied_by?(s.version)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ describe Vagrant do
|
||||||
expect(described_class.has_plugin?("bar")).to be_false
|
expect(described_class.has_plugin?("bar")).to be_false
|
||||||
end
|
end
|
||||||
|
|
||||||
it "finds plugins by gem version" do
|
it "finds plugins by gem name and version" do
|
||||||
specs = [Gem::Specification.new]
|
specs = [Gem::Specification.new]
|
||||||
specs[0].name = "foo"
|
specs[0].name = "foo"
|
||||||
specs[0].version = "1.2.3"
|
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.2.0")).to be_true
|
||||||
expect(described_class.has_plugin?("foo", "~> 1.0.0")).to be_false
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue