core: fix NoMethodError in Vagrant.has_plugin? [GH-1736]
This commit is contained in:
parent
fd68e362a0
commit
abe7830421
|
@ -7,6 +7,7 @@ IMPROVEMENTS:
|
|||
|
||||
BUG FIXES:
|
||||
|
||||
- core: Fix NoMethodError in the new `Vagrant.has_plugin?` method [GH-1736]
|
||||
- hosts/arch: NFS exporting works properly, no exceptions. [GH-2161]
|
||||
- hosts/fedora: Fix host detection encoding issues. [GH-1977]
|
||||
- hosts/linux: Fix NFS export problems with `no_subtree_check`. [GH-2156]
|
||||
|
|
|
@ -133,7 +133,7 @@ module Vagrant
|
|||
# be used from the Vagrantfile to easily branch based on plugin
|
||||
# availability.
|
||||
def self.has_plugin?(name)
|
||||
plugin("2").registered.include?(name)
|
||||
plugin("2").manager.registered.any? { |plugin| plugin.name == name }
|
||||
end
|
||||
|
||||
# Returns a superclass to use when creating a plugin for Vagrant.
|
||||
|
|
|
@ -53,4 +53,22 @@ describe Vagrant do
|
|||
to raise_error(Vagrant::Errors::PluginLoadFailed)
|
||||
end
|
||||
end
|
||||
|
||||
describe "has_plugin?" do
|
||||
after(:each) do
|
||||
described_class.plugin('2').manager.reset!
|
||||
end
|
||||
|
||||
it "should return true if the plugin is installed" do
|
||||
plugin = Class.new(described_class.plugin('2')) do
|
||||
name "i_am_installed"
|
||||
end
|
||||
|
||||
described_class.has_plugin?("i_am_installed").should be_true
|
||||
end
|
||||
|
||||
it "should return false if the plugin is not installed" do
|
||||
described_class.has_plugin?("i_dont_exist").should be_false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue