chef-apply 0.4.6 → 0.4.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -7
- data/chef-apply.gemspec +3 -3
- data/lib/chef_apply/version.rb +1 -1
- metadata +3 -38
- data/README.md +0 -62
- data/spec/fixtures/custom_config.toml +0 -2
- data/spec/integration/chef-run_spec.rb +0 -41
- data/spec/integration/fixtures/chef_help.out +0 -70
- data/spec/integration/fixtures/chef_version.out +0 -1
- data/spec/integration/spec_helper.rb +0 -55
- data/spec/spec_helper.rb +0 -154
- data/spec/support/matchers/output_to_terminal.rb +0 -36
- data/spec/unit/action/base_spec.rb +0 -60
- data/spec/unit/action/converge_target/ccr_failure_mapper_spec.rb +0 -106
- data/spec/unit/action/converge_target_spec.rb +0 -400
- data/spec/unit/action/generate_local_policy_spec.rb +0 -114
- data/spec/unit/action/generate_temp_cookbook/recipe_lookup_spec.rb +0 -122
- data/spec/unit/action/generate_temp_cookbook/temp_cookbook_spec.rb +0 -198
- data/spec/unit/action/generate_temp_cookbook_spec.rb +0 -73
- data/spec/unit/action/install_chef/minimum_chef_version_spec.rb +0 -90
- data/spec/unit/action/install_chef_spec.rb +0 -164
- data/spec/unit/cli/options_spec.rb +0 -75
- data/spec/unit/cli/validation_spec.rb +0 -81
- data/spec/unit/cli_spec.rb +0 -475
- data/spec/unit/config_spec.rb +0 -70
- data/spec/unit/file_fetcher_spec.rb +0 -40
- data/spec/unit/fixtures/multi-error.out +0 -2
- data/spec/unit/log_spec.rb +0 -37
- data/spec/unit/startup_spec.rb +0 -323
- data/spec/unit/target_host/linux_spec.rb +0 -57
- data/spec/unit/target_host/windows_spec.rb +0 -43
- data/spec/unit/target_host_spec.rb +0 -297
- data/spec/unit/target_resolver_spec.rb +0 -380
- data/spec/unit/telemeter/sender_spec.rb +0 -140
- data/spec/unit/telemeter_spec.rb +0 -191
- data/spec/unit/text/error_translation_spec.rb +0 -109
- data/spec/unit/ui/error_printer_spec.rb +0 -196
- data/spec/unit/ui/terminal_spec.rb +0 -119
- data/spec/unit/version_spec.rb +0 -31
data/spec/unit/config_spec.rb
DELETED
@@ -1,70 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright:: Copyright (c) 2018 Chef Software Inc.
|
3
|
-
# License:: Apache License, Version 2.0
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
#
|
17
|
-
|
18
|
-
require "spec_helper"
|
19
|
-
require "chef_apply/config"
|
20
|
-
|
21
|
-
RSpec.describe ChefApply::Config do
|
22
|
-
subject(:config) do
|
23
|
-
ChefApply::Config
|
24
|
-
end
|
25
|
-
|
26
|
-
before(:each) do
|
27
|
-
ChefApply::Config.reset
|
28
|
-
end
|
29
|
-
|
30
|
-
it "raises an error when trying to specify non-existing config location" do
|
31
|
-
expect { config.custom_location("/does/not/exist") }.to raise_error(RuntimeError, /No config file/)
|
32
|
-
end
|
33
|
-
|
34
|
-
it "should use default location by default" do
|
35
|
-
expect(config.using_default_location?).to eq(true)
|
36
|
-
end
|
37
|
-
|
38
|
-
context "when there is a custom config" do
|
39
|
-
let(:custom_config) { File.expand_path("../../fixtures/custom_config.toml", __FILE__) }
|
40
|
-
|
41
|
-
it "successfully loads the config" do
|
42
|
-
config.custom_location(custom_config)
|
43
|
-
expect(config.using_default_location?).to eq(false)
|
44
|
-
expect(config.exist?).to eq(true)
|
45
|
-
config.load
|
46
|
-
expect(config.telemetry.dev).to eq(true)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
describe "#load" do
|
50
|
-
before do
|
51
|
-
expect(subject).to receive(:exist?).and_return(exists)
|
52
|
-
end
|
53
|
-
|
54
|
-
context "when the config file exists" do
|
55
|
-
let(:exists) { true }
|
56
|
-
it "loads the file" do
|
57
|
-
expect(subject).to receive(:from_file)
|
58
|
-
subject.load
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
context "when the config file does not exist" do
|
63
|
-
let(:exists) { false }
|
64
|
-
it "does not try to load the file" do
|
65
|
-
expect(subject).to_not receive(:from_file)
|
66
|
-
subject.load
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright:: Copyright (c) 2018 Chef Software Inc.
|
3
|
-
# License:: Apache License, Version 2.0
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
#
|
17
|
-
|
18
|
-
require "chef_apply/file_fetcher"
|
19
|
-
require "spec_helper"
|
20
|
-
|
21
|
-
RSpec.describe ChefApply::FileFetcher do
|
22
|
-
let(:expected_local_location) { File.join(ChefApply::Config.cache.path, "example.txt") }
|
23
|
-
subject { ChefApply::FileFetcher }
|
24
|
-
describe ".fetch" do
|
25
|
-
it "returns the local path when the file is cached" do
|
26
|
-
allow(FileUtils).to receive(:mkdir)
|
27
|
-
expect(File).to receive(:exist?).with(expected_local_location).and_return(true)
|
28
|
-
result = subject.fetch("https://example.com/example.txt")
|
29
|
-
expect(result).to eq expected_local_location
|
30
|
-
end
|
31
|
-
|
32
|
-
it "returns the local path when the file is fetched" do
|
33
|
-
allow(FileUtils).to receive(:mkdir)
|
34
|
-
expect(File).to receive(:exist?).with(expected_local_location).and_return(false)
|
35
|
-
expect(subject).to receive(:download_file)
|
36
|
-
result = subject.fetch("https://example.com/example.txt")
|
37
|
-
expect(result).to eq expected_local_location
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
data/spec/unit/log_spec.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright:: Copyright (c) 2018 Chef Software Inc.
|
3
|
-
# License:: Apache License, Version 2.0
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
#
|
17
|
-
|
18
|
-
require "spec_helper"
|
19
|
-
require "chef_apply/log"
|
20
|
-
|
21
|
-
RSpec.describe ChefApply::Log do
|
22
|
-
Log = ChefApply::Log
|
23
|
-
let(:output) { StringIO.new }
|
24
|
-
|
25
|
-
before do
|
26
|
-
Log.setup output, :debug
|
27
|
-
end
|
28
|
-
|
29
|
-
after do
|
30
|
-
Log.setup File::NULL, :error
|
31
|
-
end
|
32
|
-
|
33
|
-
it "correctly logs to stdout" do
|
34
|
-
Log.debug("test")
|
35
|
-
expect(output.string).to match(/DEBUG: test$/)
|
36
|
-
end
|
37
|
-
end
|
data/spec/unit/startup_spec.rb
DELETED
@@ -1,323 +0,0 @@
|
|
1
|
-
require "chef_apply/startup"
|
2
|
-
require "chef_apply/text"
|
3
|
-
require "chef_apply/ui/terminal"
|
4
|
-
|
5
|
-
RSpec.describe ChefApply::Startup do
|
6
|
-
let(:argv) { [] }
|
7
|
-
let(:telemetry) { ChefApply::Telemeter.instance }
|
8
|
-
subject do
|
9
|
-
ChefApply::Startup.new(argv)
|
10
|
-
end
|
11
|
-
before do
|
12
|
-
allow(ChefApply::UI::Terminal).to receive(:init)
|
13
|
-
end
|
14
|
-
|
15
|
-
after do
|
16
|
-
ChefApply::Config.reset
|
17
|
-
end
|
18
|
-
|
19
|
-
describe "#initalize" do
|
20
|
-
it "initializes the terminal" do
|
21
|
-
expect_any_instance_of(ChefApply::Startup).to receive(:init_terminal)
|
22
|
-
ChefApply::Startup.new([])
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
describe "#run" do
|
27
|
-
it "performs ordered startup tasks and invokes the CLI" do
|
28
|
-
ordered_messages = %i{verify_not_in_chefdk
|
29
|
-
first_run_tasks
|
30
|
-
setup_workstation_user_directories
|
31
|
-
setup_error_handling
|
32
|
-
load_config
|
33
|
-
setup_logging
|
34
|
-
start_telemeter_upload
|
35
|
-
start_chef_apply}
|
36
|
-
ordered_messages.each do |msg|
|
37
|
-
expect(subject).to receive(msg).ordered
|
38
|
-
end
|
39
|
-
subject.run
|
40
|
-
end
|
41
|
-
|
42
|
-
context "when errors happen" do
|
43
|
-
let(:error) { nil }
|
44
|
-
let(:error_text) { ChefApply::Text.cli.error }
|
45
|
-
before do
|
46
|
-
# Force the error to happen in first_run_tasks, since it's always... well, first.
|
47
|
-
expect(subject).to receive(:first_run_tasks).and_raise(error)
|
48
|
-
end
|
49
|
-
|
50
|
-
context "when an UnknownConfigOptionError is raised" do
|
51
|
-
let(:bad_path) { "bad/path" }
|
52
|
-
let(:bad_option) { "bad_option" }
|
53
|
-
|
54
|
-
context "and it matches the expected text form" do
|
55
|
-
let(:error) { Mixlib::Config::UnknownConfigOptionError.new("unsupported config value #{bad_option}.") }
|
56
|
-
it "shows the correct error" do
|
57
|
-
expected_text = error_text.invalid_config_key(bad_option, ChefApply::Config.location)
|
58
|
-
expect(ChefApply::UI::Terminal).to receive(:output).with(expected_text)
|
59
|
-
subject.run
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
context "and it does not match the expeted text form" do
|
64
|
-
let(:msg) { "something bad happened" }
|
65
|
-
let(:error) { Mixlib::Config::UnknownConfigOptionError.new(msg) }
|
66
|
-
it "shows the correct error" do
|
67
|
-
expected_text = error_text.unknown_config_error(msg, ChefApply::Config.location)
|
68
|
-
expect(ChefApply::UI::Terminal).to receive(:output).with(expected_text)
|
69
|
-
subject.run
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
context "when a ConfigPathInvalid is raised" do
|
75
|
-
let(:bad_path) { "bad/path" }
|
76
|
-
let(:error) { ChefApply::Startup::ConfigPathInvalid.new(bad_path) }
|
77
|
-
|
78
|
-
it "shows the correct error" do
|
79
|
-
expected_text = error_text.bad_config_file(bad_path)
|
80
|
-
expect(ChefApply::UI::Terminal).to receive(:output).with(expected_text)
|
81
|
-
subject.run
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
context "when a ConfigPathNotProvided is raised" do
|
86
|
-
let(:error) { ChefApply::Startup::ConfigPathNotProvided.new }
|
87
|
-
|
88
|
-
it "shows the correct error" do
|
89
|
-
expected_text = error_text.missing_config_path
|
90
|
-
expect(ChefApply::UI::Terminal).to receive(:output).with(expected_text)
|
91
|
-
subject.run
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
context "when a UnsupportedInstallation exception is raised" do
|
96
|
-
let(:error) { ChefApply::Startup::UnsupportedInstallation.new }
|
97
|
-
|
98
|
-
it "shows the correct error" do
|
99
|
-
expected_text = error_text.unsupported_installation
|
100
|
-
expect(ChefApply::UI::Terminal).to receive(:output).with(expected_text)
|
101
|
-
subject.run
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
context "when a Tomlrb::ParserError is raised" do
|
106
|
-
let(:msg) { "Parse failed." }
|
107
|
-
let(:error) { Tomlrb::ParseError.new(msg) }
|
108
|
-
|
109
|
-
it "shows the correct error" do
|
110
|
-
expected_text = error_text.unknown_config_error(msg, ChefApply::Config.location)
|
111
|
-
expect(ChefApply::UI::Terminal).to receive(:output).with(expected_text)
|
112
|
-
subject.run
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
describe "#init_terminal" do
|
119
|
-
it "initializees the terminal for stdout" do
|
120
|
-
expect(ChefApply::UI::Terminal).to receive(:init).with($stdout)
|
121
|
-
subject.init_terminal
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
describe "#verify_not_in_chefdk" do
|
126
|
-
before do
|
127
|
-
allow(subject).to receive(:script_path).and_return script_path
|
128
|
-
end
|
129
|
-
|
130
|
-
context "when chef-run has been loaded from a *nix chefdk path" do
|
131
|
-
let(:script_path) { "/opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/chef-apply/startup.rb" }
|
132
|
-
it "raises an UnsupportedInstallation error" do
|
133
|
-
expect { subject.verify_not_in_chefdk }.to raise_error(ChefApply::Startup::UnsupportedInstallation)
|
134
|
-
end
|
135
|
-
end
|
136
|
-
context "when chef-run has been loaded from a Windows chefdk path" do
|
137
|
-
let(:script_path) { "C:\\chefdk\\embedded\\lib\\ruby\\gems\\2.5.0\\gems\\chef-apply\\startup.rb" }
|
138
|
-
it "raises an UnsupportedInstallation error" do
|
139
|
-
expect { subject.verify_not_in_chefdk }.to raise_error(ChefApply::Startup::UnsupportedInstallation)
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
context "when chef-run has been loaded from anywhere else" do
|
144
|
-
let(:script_path) { "/home/user1/dev/chef-apply" }
|
145
|
-
it "runs without error" do
|
146
|
-
subject.verify_not_in_chefdk
|
147
|
-
end
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
describe "#first_run_tasks" do
|
152
|
-
let(:first_run_complete) { true }
|
153
|
-
before do
|
154
|
-
allow(Dir).to receive(:exist?).with(ChefApply::Config::WS_BASE_PATH).and_return first_run_complete
|
155
|
-
end
|
156
|
-
|
157
|
-
context "when first run has already occurred" do
|
158
|
-
let(:first_run_complete) { true }
|
159
|
-
it "returns without taking action" do
|
160
|
-
expect(subject).to_not receive(:create_default_config)
|
161
|
-
expect(subject).to_not receive(:setup_telemetry)
|
162
|
-
subject.first_run_tasks
|
163
|
-
end
|
164
|
-
end
|
165
|
-
|
166
|
-
context "when first run has not already occurred" do
|
167
|
-
let(:first_run_complete) { false }
|
168
|
-
it "Performs required first-run tasks" do
|
169
|
-
expect(subject).to receive(:create_default_config)
|
170
|
-
expect(subject).to receive(:setup_telemetry)
|
171
|
-
subject.first_run_tasks
|
172
|
-
end
|
173
|
-
end
|
174
|
-
end
|
175
|
-
|
176
|
-
describe "#create_default_config" do
|
177
|
-
it "touches the configuration file to create it and notifies that it has done so" do
|
178
|
-
expected_config_path = ChefApply::Config.default_location
|
179
|
-
expected_message = ChefApply::Text.cli.creating_config(expected_config_path)
|
180
|
-
expect(ChefApply::UI::Terminal).to receive(:output)
|
181
|
-
.with(expected_message)
|
182
|
-
expect(ChefApply::UI::Terminal).to receive(:output)
|
183
|
-
.with("")
|
184
|
-
expect(FileUtils).to receive(:touch)
|
185
|
-
.with(expected_config_path)
|
186
|
-
subject.create_default_config
|
187
|
-
|
188
|
-
end
|
189
|
-
end
|
190
|
-
|
191
|
-
describe "#setup_telemetry" do
|
192
|
-
let(:mock_guid) { "1234" }
|
193
|
-
it "sets up a telemetry installation id and notifies the operator that telemetry is enabled" do
|
194
|
-
expect(SecureRandom).to receive(:uuid).and_return(mock_guid)
|
195
|
-
expect(File).to receive(:write)
|
196
|
-
.with(ChefApply::Config.telemetry_installation_identifier_file, mock_guid)
|
197
|
-
subject.setup_telemetry
|
198
|
-
end
|
199
|
-
end
|
200
|
-
|
201
|
-
describe "#start_telemeter_upload" do
|
202
|
-
it "launches telemetry uploads" do
|
203
|
-
expect(ChefApply::Telemeter::Sender).to receive(:start_upload_thread)
|
204
|
-
subject.start_telemeter_upload
|
205
|
-
end
|
206
|
-
end
|
207
|
-
|
208
|
-
describe "setup_workstation_user_directories" do
|
209
|
-
it "creates the required chef-workstation directories in HOME" do
|
210
|
-
expect(FileUtils).to receive(:mkdir_p).with(ChefApply::Config::WS_BASE_PATH)
|
211
|
-
expect(FileUtils).to receive(:mkdir_p).with(ChefApply::Config.base_log_directory)
|
212
|
-
expect(FileUtils).to receive(:mkdir_p).with(ChefApply::Config.telemetry_path)
|
213
|
-
subject.setup_workstation_user_directories
|
214
|
-
end
|
215
|
-
end
|
216
|
-
|
217
|
-
describe "#custom_config_path" do
|
218
|
-
context "when a custom config path is not provided as an option" do
|
219
|
-
let(:args) { [] }
|
220
|
-
it "returns nil" do
|
221
|
-
expect(subject.custom_config_path).to be_nil
|
222
|
-
end
|
223
|
-
end
|
224
|
-
|
225
|
-
context "when a --config-path is provided" do
|
226
|
-
context "but the actual path parameter is not provided" do
|
227
|
-
let(:argv) { %w{--config-path} }
|
228
|
-
it "raises ConfigPathNotProvided" do
|
229
|
-
expect { subject.custom_config_path }.to raise_error(ChefApply::Startup::ConfigPathNotProvided)
|
230
|
-
end
|
231
|
-
end
|
232
|
-
|
233
|
-
context "and the path is provided" do
|
234
|
-
let(:path) { "/mock/file.toml" }
|
235
|
-
let(:argv) { ["--config-path", path] }
|
236
|
-
|
237
|
-
context "but the path is not a file" do
|
238
|
-
before do
|
239
|
-
allow(File).to receive(:file?).with(path).and_return false
|
240
|
-
end
|
241
|
-
it "raises an error ConfigPathInvalid" do
|
242
|
-
expect { subject.custom_config_path }.to raise_error(ChefApply::Startup::ConfigPathInvalid)
|
243
|
-
end
|
244
|
-
end
|
245
|
-
|
246
|
-
context "and the path exists and is a valid file" do
|
247
|
-
before do
|
248
|
-
allow(File).to receive(:file?).with(path).and_return true
|
249
|
-
end
|
250
|
-
|
251
|
-
context "but it is not readable" do
|
252
|
-
before do
|
253
|
-
allow(File).to receive(:readable?).with(path).and_return false
|
254
|
-
end
|
255
|
-
it "raises an error ConfigPathInvalid" do
|
256
|
-
expect { subject.custom_config_path }.to raise_error(ChefApply::Startup::ConfigPathInvalid)
|
257
|
-
end
|
258
|
-
end
|
259
|
-
|
260
|
-
context "and it is readable" do
|
261
|
-
before do
|
262
|
-
allow(File).to receive(:readable?).with(path).and_return true
|
263
|
-
end
|
264
|
-
it "returns the custom path" do
|
265
|
-
expect(subject.custom_config_path).to eq path
|
266
|
-
end
|
267
|
-
end
|
268
|
-
end
|
269
|
-
end
|
270
|
-
end
|
271
|
-
end
|
272
|
-
|
273
|
-
describe "#load_config" do
|
274
|
-
context "when a custom configuraton path is provided" do
|
275
|
-
let(:config_path) { nil }
|
276
|
-
it "loads the config at the custom path" do
|
277
|
-
expect(subject).to receive(:custom_config_path).and_return config_path
|
278
|
-
expect(ChefApply::Config).to receive(:custom_location).with config_path
|
279
|
-
expect(ChefApply::Config).to receive(:load)
|
280
|
-
subject.load_config
|
281
|
-
end
|
282
|
-
let(:config_path) { "/tmp/workstation-mock-config.toml" }
|
283
|
-
end
|
284
|
-
|
285
|
-
context "when no custom configuration path is provided" do
|
286
|
-
let(:config_path) { nil }
|
287
|
-
it "loads it at the default configuration path" do
|
288
|
-
expect(subject).to receive(:custom_config_path).and_return config_path
|
289
|
-
expect(ChefApply::Config).not_to receive(:custom_location)
|
290
|
-
expect(ChefApply::Config).to receive(:load)
|
291
|
-
subject.load_config
|
292
|
-
end
|
293
|
-
end
|
294
|
-
|
295
|
-
end
|
296
|
-
|
297
|
-
describe "#setup_logging" do
|
298
|
-
let(:log_path) { "/tmp/logs" }
|
299
|
-
let(:log_level) { :debug }
|
300
|
-
before do
|
301
|
-
ChefApply::Config.log.location = log_path
|
302
|
-
ChefApply::Config.log.level = log_level
|
303
|
-
end
|
304
|
-
|
305
|
-
it "sets up the logging for ChefApply and Chef" do
|
306
|
-
expect(ChefApply::Log).to receive(:setup)
|
307
|
-
.with(ChefApply::Config.log.location, log_level)
|
308
|
-
expect(Chef::Log).to receive(:init).with(ChefApply::Log.stream)
|
309
|
-
subject.setup_logging
|
310
|
-
expect(ChefConfig.logger).to eq(ChefApply::Log)
|
311
|
-
end
|
312
|
-
end
|
313
|
-
|
314
|
-
describe "#start_chef_apply" do
|
315
|
-
let(:argv) { %w{some arguments} }
|
316
|
-
it "runs ChefApply::CLI and passes along arguments it received" do
|
317
|
-
run_double = instance_double(ChefApply::CLI)
|
318
|
-
expect(ChefApply::CLI).to receive(:new).with(argv).and_return(run_double)
|
319
|
-
expect(run_double).to receive(:run)
|
320
|
-
subject.start_chef_apply
|
321
|
-
end
|
322
|
-
end
|
323
|
-
end
|