Allow feature_enabled? to accept symbols
This commit is contained in:
parent
fc4ba7f420
commit
d551738bc7
|
@ -26,6 +26,8 @@ module Vagrant
|
|||
# @return [Boolean] - A hash containing the original array and if it is valid
|
||||
def feature_enabled?(feature)
|
||||
experimental = features_requested
|
||||
feature = feature.to_s
|
||||
|
||||
if experimental.size == 1 && experimental.first == "1"
|
||||
return true
|
||||
elsif VALID_FEATURES.include?(feature) &&
|
||||
|
|
|
@ -44,6 +44,11 @@ describe Vagrant::Util::Experimental do
|
|||
expect(subject.feature_enabled?("secret_feature")).to eq(true)
|
||||
end
|
||||
|
||||
it "returns true if flag contains feature requested and the request is a symbol" do
|
||||
allow(ENV).to receive(:[]).with("VAGRANT_EXPERIMENTAL").and_return("secret_feature")
|
||||
expect(subject.feature_enabled?(:secret_feature)).to eq(true)
|
||||
end
|
||||
|
||||
it "returns true if flag contains feature requested with other features 'enabled'" do
|
||||
allow(ENV).to receive(:[]).with("VAGRANT_EXPERIMENTAL").and_return("secret_feature,other_secret")
|
||||
expect(subject.feature_enabled?("secret_feature")).to eq(true)
|
||||
|
|
Loading…
Reference in New Issue