license-acceptance 1.0.13 → 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +23 -1
- data/lib/license_acceptance/acceptor.rb +44 -28
- data/lib/license_acceptance/cli_flags/mixlib_cli.rb +2 -2
- data/lib/license_acceptance/cli_flags/thor.rb +3 -3
- data/lib/license_acceptance/config.rb +5 -4
- data/lib/license_acceptance/product.rb +8 -6
- data/lib/license_acceptance/product_reader.rb +8 -4
- data/lib/license_acceptance/strategy/argument.rb +16 -15
- data/lib/license_acceptance/strategy/environment.rb +10 -9
- data/lib/license_acceptance/strategy/file.rb +8 -10
- data/lib/license_acceptance/strategy/prompt.rb +24 -24
- data/lib/license_acceptance/strategy/provided_value.rb +7 -4
- data/lib/license_acceptance/version.rb +1 -1
- metadata +6 -132
- data/Gemfile.lock +0 -91
- data/Rakefile +0 -6
- data/spec/license_acceptance/acceptor_spec.rb +0 -302
- data/spec/license_acceptance/cli_flags/mixlib_cli_spec.rb +0 -14
- data/spec/license_acceptance/cli_flags/thor_spec.rb +0 -14
- data/spec/license_acceptance/config_spec.rb +0 -111
- data/spec/license_acceptance/product_reader_spec.rb +0 -155
- data/spec/license_acceptance/product_spec.rb +0 -15
- data/spec/license_acceptance/strategy/argument_spec.rb +0 -82
- data/spec/license_acceptance/strategy/environment_spec.rb +0 -76
- data/spec/license_acceptance/strategy/file_spec.rb +0 -127
- data/spec/license_acceptance/strategy/prompt_spec.rb +0 -100
- data/spec/license_acceptance/strategy/provided_value_spec.rb +0 -55
- data/spec/spec_helper.rb +0 -25
@@ -1,14 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
require "license_acceptance/cli_flags/mixlib_cli"
|
3
|
-
|
4
|
-
class TestMixlibKlass
|
5
|
-
include Mixlib::CLI
|
6
|
-
include LicenseAcceptance::CLIFlags::MixlibCLI
|
7
|
-
end
|
8
|
-
|
9
|
-
RSpec.describe LicenseAcceptance::CLIFlags::MixlibCLI do
|
10
|
-
let(:klass) { TestMixlibKlass.new }
|
11
|
-
it "adds the correct command line flag" do
|
12
|
-
expect(klass.options).to include(:chef_license)
|
13
|
-
end
|
14
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
require "license_acceptance/cli_flags/thor"
|
3
|
-
require "thor"
|
4
|
-
|
5
|
-
class TestThorKlass < Thor
|
6
|
-
include LicenseAcceptance::CLIFlags::Thor
|
7
|
-
end
|
8
|
-
|
9
|
-
RSpec.describe LicenseAcceptance::CLIFlags::Thor do
|
10
|
-
let(:klass) { TestThorKlass.new }
|
11
|
-
it "adds the correct command line flag" do
|
12
|
-
expect(klass.class.class_options.keys).to eq([:chef_license])
|
13
|
-
end
|
14
|
-
end
|
@@ -1,111 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
require "climate_control"
|
3
|
-
require "license_acceptance/config"
|
4
|
-
require "license_acceptance/product_relationship"
|
5
|
-
|
6
|
-
RSpec.describe LicenseAcceptance::Config do
|
7
|
-
let(:opts) { {} }
|
8
|
-
let(:config) { LicenseAcceptance::Config.new(opts) }
|
9
|
-
|
10
|
-
it "loads correctly with default values" do
|
11
|
-
config
|
12
|
-
end
|
13
|
-
|
14
|
-
describe "with overwritten values" do
|
15
|
-
let(:output) { StringIO.new }
|
16
|
-
let(:logger) { "logger" }
|
17
|
-
let(:license_locations) { [] }
|
18
|
-
let(:persist_location) { "foo" }
|
19
|
-
let(:persist) { false }
|
20
|
-
let(:opts) { { output: output, logger: logger, license_locations: license_locations, persist_location: persist_location, persist: persist } }
|
21
|
-
|
22
|
-
it "loads correctly" do
|
23
|
-
expect(config.output).to eq(output)
|
24
|
-
expect(config.logger).to eq(logger)
|
25
|
-
expect(config.license_locations).to eq(license_locations)
|
26
|
-
expect(config.persist_location).to eq("foo")
|
27
|
-
expect(config.persist).to eq(false)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
describe "#default_license_locations and #default_persist_location" do
|
32
|
-
before do
|
33
|
-
expect(Process).to receive(:uid).and_return(uid)
|
34
|
-
end
|
35
|
-
|
36
|
-
describe "when platform is Windows" do
|
37
|
-
before do
|
38
|
-
stub_const("RUBY_PLATFORM", "mingw")
|
39
|
-
end
|
40
|
-
|
41
|
-
describe "when user is Administrator" do
|
42
|
-
let(:uid) { 0 }
|
43
|
-
|
44
|
-
it "returns the default value" do
|
45
|
-
ClimateControl.modify HOMEDRIVE: "C:" do
|
46
|
-
expect(config.license_locations).to eq(["C:/chef/accepted_licenses/"])
|
47
|
-
expect(config.persist_location).to eq("C:/chef/accepted_licenses/")
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
describe "when user is not Administrator" do
|
53
|
-
let(:uid) { 1000 }
|
54
|
-
|
55
|
-
it "returns the default USERPROFILE value" do
|
56
|
-
ClimateControl.modify HOMEDRIVE: "C:", USERPROFILE: "C:/Users/foo", HOME: nil do
|
57
|
-
expect(Dir).to receive(:exist?).with("C:/Users/foo").and_return(true)
|
58
|
-
expect(config.license_locations).to eq([
|
59
|
-
"C:/chef/accepted_licenses/",
|
60
|
-
"C:/Users/foo/.chef/accepted_licenses/"
|
61
|
-
])
|
62
|
-
expect(config.persist_location).to eq("C:/Users/foo/.chef/accepted_licenses/")
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
it "returns the default HOMEDRIVE + HOMEPATH value" do
|
67
|
-
ClimateControl.modify HOMEDRIVE: "C:", USERPROFILE: "C:/Users/bar", HOME: nil do
|
68
|
-
expect(Dir).to receive(:exist?).with("C:/Users/bar").and_return(true)
|
69
|
-
expect(config.license_locations).to eq([
|
70
|
-
"C:/chef/accepted_licenses/",
|
71
|
-
"C:/Users/bar/.chef/accepted_licenses/"
|
72
|
-
])
|
73
|
-
expect(config.persist_location).to eq("C:/Users/bar/.chef/accepted_licenses/")
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
end
|
79
|
-
|
80
|
-
describe "when platform is non-Windows" do
|
81
|
-
before do
|
82
|
-
stub_const("RUBY_PLATFORM", "darwin")
|
83
|
-
end
|
84
|
-
|
85
|
-
describe "when user is root" do
|
86
|
-
let(:uid) { 0 }
|
87
|
-
|
88
|
-
it "returns the default value" do
|
89
|
-
expect(config.license_locations).to eq(["/etc/chef/accepted_licenses/"])
|
90
|
-
expect(config.persist_location).to eq("/etc/chef/accepted_licenses/")
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
describe "when user is not root" do
|
95
|
-
let(:uid) { 1000 }
|
96
|
-
|
97
|
-
it "returns the default user value" do
|
98
|
-
ClimateControl.modify HOME: "/Users/foo" do
|
99
|
-
expect(config.license_locations).to eq([
|
100
|
-
"/etc/chef/accepted_licenses/",
|
101
|
-
"/Users/foo/.chef/accepted_licenses/"
|
102
|
-
])
|
103
|
-
expect(config.persist_location).to eq("/Users/foo/.chef/accepted_licenses/")
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
end
|
@@ -1,155 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
require "license_acceptance/product_reader"
|
3
|
-
require "license_acceptance/product_relationship"
|
4
|
-
|
5
|
-
RSpec.describe LicenseAcceptance::ProductReader do
|
6
|
-
let(:reader) { LicenseAcceptance::ProductReader.new }
|
7
|
-
let(:version) { "0.1.0" }
|
8
|
-
let(:location) { "location" }
|
9
|
-
|
10
|
-
let(:p1) { {"id" => "p1", "pretty_name" => "P1", "filename" => "f1", "mixlib_name" => "p1m", "license_required_version" => "p1v"} }
|
11
|
-
let(:p2) { {"id" => "p2", "pretty_name" => "P2", "filename" => "f2", "mixlib_name" => "p2m", "license_required_version" => "p2v"} }
|
12
|
-
# defined the `==` operator on Product for ease of comparison
|
13
|
-
let(:product1) { LicenseAcceptance::Product.new(p1["id"], p1["pretty_name"], p1["filename"], p1["mixlib_name"], p1["license_required_version"]) }
|
14
|
-
let(:product2) { LicenseAcceptance::Product.new(p2["id"], p2["pretty_name"], p2["filename"], p2["mixlib_name"], p2["license_required_version"]) }
|
15
|
-
let(:r1) { {p1 => p2} }
|
16
|
-
let(:toml) { {"products" => [p1, p2], "relationships" => {"p1" => ["p2"]}} }
|
17
|
-
|
18
|
-
describe "#read" do
|
19
|
-
it "reads products and relationships" do
|
20
|
-
expect(reader).to receive(:get_location).and_return(location)
|
21
|
-
expect(Tomlrb).to receive(:load_file).with(location, symbolize_keys: false).and_return(toml)
|
22
|
-
reader.read
|
23
|
-
expect(reader.products).to eq({
|
24
|
-
"p1" => product1,
|
25
|
-
"p2" => product2
|
26
|
-
})
|
27
|
-
expect(reader.relationships.size).to eq(1)
|
28
|
-
expect(reader.relationships.first).to eq([product1, [product2]])
|
29
|
-
end
|
30
|
-
|
31
|
-
describe "with an empty file" do
|
32
|
-
it "raises a InvalidProductInfo error" do
|
33
|
-
expect(reader).to receive(:get_location).and_return(location)
|
34
|
-
expect(Tomlrb).to receive(:load_file).with(location, symbolize_keys: false).and_return({})
|
35
|
-
|
36
|
-
expect { reader.read }.to raise_error(LicenseAcceptance::InvalidProductInfo)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
describe "with an unknown parent" do
|
41
|
-
let(:toml) { {"products" => [p1, p2], "relationships" => {"p3" => ["p2"]}} }
|
42
|
-
|
43
|
-
it "raises a UnknownParent error" do
|
44
|
-
expect(reader).to receive(:get_location).and_return(location)
|
45
|
-
expect(Tomlrb).to receive(:load_file).with(location, symbolize_keys: false).and_return(toml)
|
46
|
-
|
47
|
-
expect { reader.read }.to raise_error(LicenseAcceptance::UnknownParent)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
describe "with a relationship of nil children" do
|
52
|
-
let(:toml) { {"products" => [p1], "relationships" => {"p1" => nil}} }
|
53
|
-
|
54
|
-
it "raises a NoChildRelationships error" do
|
55
|
-
expect(reader).to receive(:get_location).and_return(location)
|
56
|
-
expect(Tomlrb).to receive(:load_file).with(location, symbolize_keys: false).and_return(toml)
|
57
|
-
|
58
|
-
expect { reader.read }.to raise_error(LicenseAcceptance::NoChildRelationships)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
describe "with a relationship of empty children" do
|
63
|
-
let(:toml) { {"products" => [p1], "relationships" => {"p1" => []}} }
|
64
|
-
|
65
|
-
it "raises a NoChildRelationships error" do
|
66
|
-
expect(reader).to receive(:get_location).and_return(location)
|
67
|
-
expect(Tomlrb).to receive(:load_file).with(location, symbolize_keys: false).and_return(toml)
|
68
|
-
|
69
|
-
expect { reader.read }.to raise_error(LicenseAcceptance::NoChildRelationships)
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
describe "with a relationship of non-array children" do
|
74
|
-
let(:toml) { {"products" => [p1], "relationships" => {"p1" => "p2"}} }
|
75
|
-
|
76
|
-
it "raises a NoChildRelationships error" do
|
77
|
-
expect(reader).to receive(:get_location).and_return(location)
|
78
|
-
expect(Tomlrb).to receive(:load_file).with(location, symbolize_keys: false).and_return(toml)
|
79
|
-
|
80
|
-
expect { reader.read }.to raise_error(LicenseAcceptance::NoChildRelationships)
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
describe "with an unknown child" do
|
85
|
-
let(:toml) { {"products" => [p1, p2], "relationships" => {"p1" => ["p2", "p3"]}} }
|
86
|
-
|
87
|
-
it "raises a UnknownChild error" do
|
88
|
-
expect(reader).to receive(:get_location).and_return(location)
|
89
|
-
expect(Tomlrb).to receive(:load_file).with(location, symbolize_keys: false).and_return(toml)
|
90
|
-
|
91
|
-
expect { reader.read }.to raise_error(LicenseAcceptance::UnknownChild)
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
describe "::lookup" do
|
97
|
-
before do
|
98
|
-
expect(reader).to receive(:get_location).and_return(location)
|
99
|
-
expect(Tomlrb).to receive(:load_file).with(location, symbolize_keys: false).and_return(toml)
|
100
|
-
reader.read
|
101
|
-
end
|
102
|
-
|
103
|
-
it "returns a ProductRelationship instance successfully" do
|
104
|
-
expect(reader.lookup("p1", version)).to be_an_instance_of(LicenseAcceptance::ProductRelationship) do |instance|
|
105
|
-
expect(instance.parent_product).to eq(product1)
|
106
|
-
expect(instance.children).to eq([prouct2])
|
107
|
-
expect(instance.version).to eq(version)
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
describe "when called on an unknown product" do
|
112
|
-
it "raises an UnknownProduct error" do
|
113
|
-
expect { reader.lookup("DNE", nil) }.to raise_error(LicenseAcceptance::UnknownProduct)
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
let(:nonya) { LicenseAcceptance::Product.new("nonya", "NonYa", "nofile", "no_mixlib", "no_version") }
|
118
|
-
describe "when called on a product with no relationship" do
|
119
|
-
before do
|
120
|
-
reader.products = { "nonya" => nonya }
|
121
|
-
end
|
122
|
-
|
123
|
-
it "returns the product" do
|
124
|
-
expect(reader.lookup('nonya', version)).to be_an_instance_of(LicenseAcceptance::ProductRelationship) do |instance|
|
125
|
-
expect(instance.parent_product).to eq(nonya)
|
126
|
-
expect(instance.children).to eq([])
|
127
|
-
expect(instance.version).to eq(version)
|
128
|
-
end
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
describe "when called with an invalid parent version type" do
|
133
|
-
it "raises an ProductVersionTypeError error" do
|
134
|
-
expect { reader.lookup("p1", 1) }.to raise_error(LicenseAcceptance::ProductVersionTypeError)
|
135
|
-
end
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
describe "::lookup_by_mixlib" do
|
140
|
-
before do
|
141
|
-
expect(reader).to receive(:get_location).and_return(location)
|
142
|
-
expect(Tomlrb).to receive(:load_file).with(location, symbolize_keys: false).and_return(toml)
|
143
|
-
reader.read
|
144
|
-
end
|
145
|
-
|
146
|
-
it "returns a Product successfully" do
|
147
|
-
expect(reader.lookup_by_mixlib("p1m")).to eq(product1)
|
148
|
-
end
|
149
|
-
|
150
|
-
it "returns nil for an unknown product" do
|
151
|
-
expect(reader.lookup_by_mixlib("foo")).to eq(nil)
|
152
|
-
end
|
153
|
-
end
|
154
|
-
|
155
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
require "license_acceptance/product"
|
3
|
-
|
4
|
-
RSpec.describe LicenseAcceptance::Product do
|
5
|
-
let(:instance) { LicenseAcceptance::Product.new("id", "Pretty Name", "filename", "mixlib_name", "version") }
|
6
|
-
|
7
|
-
it "can lookup the product attributes" do
|
8
|
-
expect(instance.id).to eq("id")
|
9
|
-
expect(instance.pretty_name).to eq("Pretty Name")
|
10
|
-
expect(instance.filename).to eq("filename")
|
11
|
-
expect(instance.mixlib_name).to eq("mixlib_name")
|
12
|
-
expect(instance.license_required_version).to eq("version")
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
@@ -1,82 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
require "license_acceptance/strategy/argument"
|
3
|
-
|
4
|
-
RSpec.describe LicenseAcceptance::Strategy::Argument do
|
5
|
-
let(:acc) { LicenseAcceptance::Strategy::Argument.new(argv) }
|
6
|
-
|
7
|
-
describe "#accepted?" do
|
8
|
-
describe "when value is space seperated" do
|
9
|
-
let(:argv) { ["--chef-license", "accept"] }
|
10
|
-
it "returns true if the args contain the required flag with spaces" do
|
11
|
-
expect(acc.accepted?).to eq(true)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
describe "when the value is equal seperated" do
|
16
|
-
let(:argv) { ["--chef-license=accept"] }
|
17
|
-
it "returns true if the args contain the required flag with equal" do
|
18
|
-
expect(acc.accepted?).to eq(true)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
[ ["--chef-license"], ["--chef-license=foo"], ["--chef-license", "foo"] ].each do |v|
|
23
|
-
describe "when the value is #{v}" do
|
24
|
-
let(:argv) { v }
|
25
|
-
it "returns false if the args do not contain the required value" do
|
26
|
-
expect(acc.accepted?).to eq(false)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
describe "#silent?" do
|
33
|
-
describe "when value is space seperated" do
|
34
|
-
let(:argv) { ["--chef-license", "accept-silent"] }
|
35
|
-
it "returns true if the args contain the required flag with spaces" do
|
36
|
-
expect(acc.silent?).to eq(true)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
describe "when the value is equal seperated" do
|
41
|
-
let(:argv) { ["--chef-license=accept-silent"] }
|
42
|
-
it "returns true if the args contain the required flag with equal" do
|
43
|
-
expect(acc.silent?).to eq(true)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
[ ["--chef-license"], ["--chef-license=accept"], ["--chef-license", "accept"] ].each do |v|
|
48
|
-
describe "when the value is #{v}" do
|
49
|
-
let(:argv) { v }
|
50
|
-
it "returns false if the args do not contain the required value" do
|
51
|
-
expect(acc.silent?).to eq(false)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
describe "#no_persist?" do
|
58
|
-
describe "when value is space seperated" do
|
59
|
-
let(:argv) { ["--chef-license", "accept-no-persist"] }
|
60
|
-
it "returns true if the args contain the required flag with spaces" do
|
61
|
-
expect(acc.no_persist?).to eq(true)
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
describe "when the value is equal seperated" do
|
66
|
-
let(:argv) { ["--chef-license=accept-no-persist"] }
|
67
|
-
it "returns true if the args contain the required flag with equal" do
|
68
|
-
expect(acc.no_persist?).to eq(true)
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
[ ["--chef-license"], ["--chef-license=accept"], ["--chef-license", "accept"] ].each do |v|
|
73
|
-
describe "when the value is #{v}" do
|
74
|
-
let(:argv) { v }
|
75
|
-
it "returns false if the args do not contain the required value" do
|
76
|
-
expect(acc.no_persist?).to eq(false)
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
end
|
@@ -1,76 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
require "license_acceptance/strategy/environment"
|
3
|
-
|
4
|
-
RSpec.describe LicenseAcceptance::Strategy::Environment do
|
5
|
-
let(:acc) { LicenseAcceptance::Strategy::Environment.new(env) }
|
6
|
-
|
7
|
-
describe "#accepted?" do
|
8
|
-
describe "when the environment contains the correct key and value" do
|
9
|
-
let(:env) { {"CHEF_LICENSE" => "accept"} }
|
10
|
-
it "returns true" do
|
11
|
-
expect(acc.accepted?).to eq(true)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
describe "when the env has a key but nil value" do
|
16
|
-
let(:env) { {"CHEF_LICENSE" => nil} }
|
17
|
-
it "returns false" do
|
18
|
-
expect(acc.accepted?).to eq(false)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
describe "when the env has a key but incorrect value" do
|
23
|
-
let(:env) { {"CHEF_LICENSE" => "foo"} }
|
24
|
-
it "returns false" do
|
25
|
-
expect(acc.accepted?).to eq(false)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
describe "#silent?" do
|
31
|
-
describe "when the environment contains the correct key and value" do
|
32
|
-
let(:env) { {"CHEF_LICENSE" => "accept-silent"} }
|
33
|
-
it "returns true" do
|
34
|
-
expect(acc.silent?).to eq(true)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
describe "when the env has a key but nil value" do
|
39
|
-
let(:env) { {"CHEF_LICENSE" => nil} }
|
40
|
-
it "returns false" do
|
41
|
-
expect(acc.silent?).to eq(false)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
describe "when the env has a key but incorrect value" do
|
46
|
-
let(:env) { {"CHEF_LICENSE" => "accept"} }
|
47
|
-
it "returns false" do
|
48
|
-
expect(acc.silent?).to eq(false)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
describe "#no_persist?" do
|
54
|
-
describe "when the environment contains the correct key and value" do
|
55
|
-
let(:env) { {"CHEF_LICENSE" => "accept-no-persist"} }
|
56
|
-
it "returns true" do
|
57
|
-
expect(acc.no_persist?).to eq(true)
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
describe "when the env has a key but nil value" do
|
62
|
-
let(:env) { {"CHEF_LICENSE" => nil} }
|
63
|
-
it "returns false" do
|
64
|
-
expect(acc.no_persist?).to eq(false)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
describe "when the env has a key but incorrect value" do
|
69
|
-
let(:env) { {"CHEF_LICENSE" => "accept-silent"} }
|
70
|
-
it "returns false" do
|
71
|
-
expect(acc.no_persist?).to eq(false)
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
end
|