Update to global_enabled?
This commit is contained in:
parent
1a32930017
commit
fc4ba7f420
|
@ -166,7 +166,7 @@ begin
|
||||||
# 0 - Disables experimental features
|
# 0 - Disables experimental features
|
||||||
# 1 - Enables all features
|
# 1 - Enables all features
|
||||||
# String - Enables one or more features, separated by commas
|
# String - Enables one or more features, separated by commas
|
||||||
if Vagrant::Util::Experimental.enabled?
|
if Vagrant::Util::Experimental.global_enabled?
|
||||||
experimental = Vagrant::Util::Experimental.features_requested
|
experimental = Vagrant::Util::Experimental.features_requested
|
||||||
ui = Vagrant::UI::Prefixed.new(env.ui, "vagrant")
|
ui = Vagrant::UI::Prefixed.new(env.ui, "vagrant")
|
||||||
logger.debug("Experimental flag is enabled")
|
logger.debug("Experimental flag is enabled")
|
||||||
|
|
|
@ -7,7 +7,7 @@ module Vagrant
|
||||||
# A method for determining if the experimental flag has been enabled
|
# A method for determining if the experimental flag has been enabled
|
||||||
#
|
#
|
||||||
# @return [Boolean]
|
# @return [Boolean]
|
||||||
def enabled?
|
def global_enabled?
|
||||||
if !defined?(@_experimental)
|
if !defined?(@_experimental)
|
||||||
experimental = ENV["VAGRANT_EXPERIMENTAL"].to_s
|
experimental = ENV["VAGRANT_EXPERIMENTAL"].to_s
|
||||||
if experimental != "0" && !experimental.empty?
|
if experimental != "0" && !experimental.empty?
|
||||||
|
|
|
@ -7,25 +7,25 @@ describe Vagrant::Util::Experimental do
|
||||||
before(:each) { described_class.reset! }
|
before(:each) { described_class.reset! }
|
||||||
subject { described_class }
|
subject { described_class }
|
||||||
|
|
||||||
describe "#enabled?" do
|
describe "#global_enabled?" do
|
||||||
it "returns true if enabled with '1'" do
|
it "returns true if enabled with '1'" do
|
||||||
allow(ENV).to receive(:[]).with("VAGRANT_EXPERIMENTAL").and_return("1")
|
allow(ENV).to receive(:[]).with("VAGRANT_EXPERIMENTAL").and_return("1")
|
||||||
expect(subject.enabled?).to eq(true)
|
expect(subject.global_enabled?).to eq(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns true if enabled with a list of features" do
|
it "returns true if enabled with a list of features" do
|
||||||
allow(ENV).to receive(:[]).with("VAGRANT_EXPERIMENTAL").and_return("list,of,features")
|
allow(ENV).to receive(:[]).with("VAGRANT_EXPERIMENTAL").and_return("list,of,features")
|
||||||
expect(subject.enabled?).to eq(true)
|
expect(subject.global_enabled?).to eq(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns false if disabled" do
|
it "returns false if disabled" do
|
||||||
allow(ENV).to receive(:[]).with("VAGRANT_EXPERIMENTAL").and_return("0")
|
allow(ENV).to receive(:[]).with("VAGRANT_EXPERIMENTAL").and_return("0")
|
||||||
expect(subject.enabled?).to eq(false)
|
expect(subject.global_enabled?).to eq(false)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns false if not set" do
|
it "returns false if not set" do
|
||||||
allow(ENV).to receive(:[]).with("VAGRANT_EXPERIMENTAL").and_return(nil)
|
allow(ENV).to receive(:[]).with("VAGRANT_EXPERIMENTAL").and_return(nil)
|
||||||
expect(subject.enabled?).to eq(false)
|
expect(subject.global_enabled?).to eq(false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue