license-acceptance 0.2.10 → 0.2.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/lib/license_acceptance/acceptor.rb +24 -22
- data/lib/license_acceptance/strategy/argument.rb +44 -0
- data/lib/license_acceptance/strategy/base.rb +11 -0
- data/lib/license_acceptance/strategy/environment.rb +38 -0
- data/lib/license_acceptance/strategy/file.rb +102 -0
- data/lib/license_acceptance/strategy/prompt.rb +111 -0
- data/lib/license_acceptance/strategy/provided_value.rb +28 -0
- data/lib/license_acceptance/version.rb +1 -1
- data/spec/license_acceptance/acceptor_spec.rb +37 -73
- data/spec/license_acceptance/strategy/argument_spec.rb +82 -0
- data/spec/license_acceptance/strategy/environment_spec.rb +76 -0
- data/spec/license_acceptance/{file_acceptance_spec.rb → strategy/file_spec.rb} +3 -3
- data/spec/license_acceptance/{prompt_acceptance_spec.rb → strategy/prompt_spec.rb} +4 -4
- data/spec/license_acceptance/strategy/provided_value_spec.rb +55 -0
- metadata +14 -11
- data/lib/license_acceptance/arg_acceptance.rb +0 -32
- data/lib/license_acceptance/env_acceptance.rb +0 -26
- data/lib/license_acceptance/file_acceptance.rb +0 -97
- data/lib/license_acceptance/prompt_acceptance.rb +0 -106
- data/spec/license_acceptance/arg_acceptance_spec.rb +0 -57
- data/spec/license_acceptance/env_acceptance_spec.rb +0 -65
@@ -1,65 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
require "license_acceptance/env_acceptance"
|
3
|
-
|
4
|
-
RSpec.describe LicenseAcceptance::EnvAcceptance do
|
5
|
-
let(:acc) { LicenseAcceptance::EnvAcceptance.new }
|
6
|
-
|
7
|
-
describe "when passed an accept value" do
|
8
|
-
describe "#accepted?" do
|
9
|
-
it "returns true if the env contains the correct key and value" do
|
10
|
-
env = {"CHEF_LICENSE" => "accept"}
|
11
|
-
expect(acc.accepted?(env)).to eq(true)
|
12
|
-
end
|
13
|
-
|
14
|
-
it "returns false if the env has a key but nil value" do
|
15
|
-
env = {"CHEF_LICENSE" => nil}
|
16
|
-
expect(acc.accepted?(env)).to eq(false)
|
17
|
-
end
|
18
|
-
|
19
|
-
it "returns false if the env has a key but incorrect value" do
|
20
|
-
env = {"CHEF_LICENSE" => "foo"}
|
21
|
-
expect(acc.accepted?(env)).to eq(false)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
describe "#silent?" do
|
26
|
-
it "returns true if the env contains the correct key and value" do
|
27
|
-
env = {"CHEF_LICENSE" => "accept-silent"}
|
28
|
-
expect(acc.silent?(env)).to eq(true)
|
29
|
-
end
|
30
|
-
|
31
|
-
it "returns false if the env has a key but nil value" do
|
32
|
-
env = {"CHEF_LICENSE" => nil}
|
33
|
-
expect(acc.silent?(env)).to eq(false)
|
34
|
-
end
|
35
|
-
|
36
|
-
it "returns false if the env has a key but incorrect value" do
|
37
|
-
env = {"CHEF_LICENSE" => "foo"}
|
38
|
-
expect(acc.silent?(env)).to eq(false)
|
39
|
-
env = {"CHEF_LICENSE" => "accept"}
|
40
|
-
expect(acc.silent?(env)).to eq(false)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
45
|
-
|
46
|
-
describe "#no_persist?" do
|
47
|
-
it "returns true if the env contains the correct key and value" do
|
48
|
-
env = {"CHEF_LICENSE" => "accept-no-persist"}
|
49
|
-
expect(acc.no_persist?(env)).to eq(true)
|
50
|
-
end
|
51
|
-
|
52
|
-
it "returns false if the env has a key but nil value" do
|
53
|
-
env = {"CHEF_LICENSE" => nil}
|
54
|
-
expect(acc.no_persist?(env)).to eq(false)
|
55
|
-
end
|
56
|
-
|
57
|
-
it "returns false if the env has a key but incorrect value" do
|
58
|
-
env = {"CHEF_LICENSE" => "foo"}
|
59
|
-
expect(acc.no_persist?(env)).to eq(false)
|
60
|
-
env = {"CHEF_LICENSE" => "accept"}
|
61
|
-
expect(acc.no_persist?(env)).to eq(false)
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
end
|