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.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -7
  3. data/chef-apply.gemspec +3 -3
  4. data/lib/chef_apply/version.rb +1 -1
  5. metadata +3 -38
  6. data/README.md +0 -62
  7. data/spec/fixtures/custom_config.toml +0 -2
  8. data/spec/integration/chef-run_spec.rb +0 -41
  9. data/spec/integration/fixtures/chef_help.out +0 -70
  10. data/spec/integration/fixtures/chef_version.out +0 -1
  11. data/spec/integration/spec_helper.rb +0 -55
  12. data/spec/spec_helper.rb +0 -154
  13. data/spec/support/matchers/output_to_terminal.rb +0 -36
  14. data/spec/unit/action/base_spec.rb +0 -60
  15. data/spec/unit/action/converge_target/ccr_failure_mapper_spec.rb +0 -106
  16. data/spec/unit/action/converge_target_spec.rb +0 -400
  17. data/spec/unit/action/generate_local_policy_spec.rb +0 -114
  18. data/spec/unit/action/generate_temp_cookbook/recipe_lookup_spec.rb +0 -122
  19. data/spec/unit/action/generate_temp_cookbook/temp_cookbook_spec.rb +0 -198
  20. data/spec/unit/action/generate_temp_cookbook_spec.rb +0 -73
  21. data/spec/unit/action/install_chef/minimum_chef_version_spec.rb +0 -90
  22. data/spec/unit/action/install_chef_spec.rb +0 -164
  23. data/spec/unit/cli/options_spec.rb +0 -75
  24. data/spec/unit/cli/validation_spec.rb +0 -81
  25. data/spec/unit/cli_spec.rb +0 -475
  26. data/spec/unit/config_spec.rb +0 -70
  27. data/spec/unit/file_fetcher_spec.rb +0 -40
  28. data/spec/unit/fixtures/multi-error.out +0 -2
  29. data/spec/unit/log_spec.rb +0 -37
  30. data/spec/unit/startup_spec.rb +0 -323
  31. data/spec/unit/target_host/linux_spec.rb +0 -57
  32. data/spec/unit/target_host/windows_spec.rb +0 -43
  33. data/spec/unit/target_host_spec.rb +0 -297
  34. data/spec/unit/target_resolver_spec.rb +0 -380
  35. data/spec/unit/telemeter/sender_spec.rb +0 -140
  36. data/spec/unit/telemeter_spec.rb +0 -191
  37. data/spec/unit/text/error_translation_spec.rb +0 -109
  38. data/spec/unit/ui/error_printer_spec.rb +0 -196
  39. data/spec/unit/ui/terminal_spec.rb +0 -119
  40. data/spec/unit/version_spec.rb +0 -31
@@ -1,119 +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/ui/terminal"
20
-
21
- RSpec.describe ChefApply::UI::Terminal do
22
- Terminal = ChefApply::UI::Terminal
23
- # Lets send our Terminal output somewhere so it does not clutter the
24
- # test output
25
- Terminal.location = StringIO.new
26
-
27
- it "correctly outputs a message" do
28
- expect { Terminal.output("test") }
29
- .to output("test\n").to_terminal
30
- end
31
-
32
- context "#render_job" do
33
- it "executes the provided block" do
34
- @ran = false
35
- job = Terminal::Job.new("prefix", nil) do
36
- @ran = true
37
- end
38
- Terminal.render_job("a message", job)
39
- expect(@ran).to eq true
40
- end
41
- end
42
-
43
- context "#render_parallel_jobs" do
44
- it "executes the provided job instances" do
45
- @job1ran = false
46
- @job2ran = false
47
- job1 = Terminal::Job.new("prefix", nil) do
48
- @job1ran = true
49
- end
50
- job2 = Terminal::Job.new("prefix", nil) do
51
- @job2ran = true
52
- end
53
- Terminal.render_parallel_jobs("a message", [job1, job2])
54
- expect(@job1ran).to eq true
55
- expect(@job2ran).to eq true
56
- end
57
- it "always resets the cursor to visible" do
58
- job1 = Terminal::Job.new("prefix", nil) do
59
- raise "Cursor should be set visible"
60
- end
61
- expect(Terminal).to receive(:show_cursor)
62
- Terminal.render_parallel_jobs("a message", [job1])
63
- end
64
- end
65
-
66
- describe ChefApply::UI::Terminal::Job do
67
- subject { ChefApply::UI::Terminal::Job }
68
- context "#exception" do
69
- context "when no exception occurs in execution" do
70
- context "and it's been invoked directly" do
71
- it "exception is nil" do
72
- job = subject.new("", nil) { 0 }
73
- job.run(ChefApply::MockReporter.new)
74
- expect(job.exception).to eq nil
75
- end
76
- end
77
- context "and it's running in a thread alongside other jobs" do
78
- it "exception is nil for each job" do
79
- job1 = subject.new("", nil) { 0 }
80
- job2 = subject.new("", nil) { 0 }
81
- threads = []
82
- threads << Thread.new { job1.run(ChefApply::MockReporter.new) }
83
- threads << Thread.new { job2.run(ChefApply::MockReporter.new) }
84
- threads.each(&:join)
85
- expect(job1.exception).to eq nil
86
- expect(job2.exception).to eq nil
87
-
88
- end
89
- end
90
- end
91
- context "when an exception occurs in execution" do
92
- context "and it's been invoked directly" do
93
- it "captures the exception in #exception" do
94
- expected_exception = StandardError.new("exception 1")
95
- job = subject.new("", nil) { |arg| raise expected_exception }
96
- job.run(ChefApply::MockReporter.new)
97
- expect(job.exception).to eq expected_exception
98
- end
99
- end
100
-
101
- context "and it's running in a thread alongside other jobs" do
102
- it "each job holds its own exception" do
103
- e1 = StandardError.new("exception 1")
104
- e2 = StandardError.new("exception 2")
105
-
106
- job1 = subject.new("", nil) { |_| raise e1 }
107
- job2 = subject.new("", nil) { |_| raise e2 }
108
- threads = []
109
- threads << Thread.new { job1.run(ChefApply::MockReporter.new) }
110
- threads << Thread.new { job2.run(ChefApply::MockReporter.new) }
111
- threads.each(&:join)
112
- expect(job1.exception).to eq e1
113
- expect(job2.exception).to eq e2
114
- end
115
- end
116
- end
117
- end
118
- end
119
- end
@@ -1,31 +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/version"
20
-
21
- RSpec.describe ChefApply::VERSION do
22
- subject(:version) do
23
- ChefApply::VERSION
24
- end
25
-
26
- context "VERSION" do
27
- it "returns the version" do
28
- expect(Gem::Version.correct?(version)).to be_truthy
29
- end
30
- end
31
- end