chefspec 8.0.1 → 9.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +16 -9
- data/Rakefile +60 -52
- data/chefspec.gemspec +20 -20
- data/lib/chefspec.rb +29 -29
- data/lib/chefspec/api.rb +15 -13
- data/lib/chefspec/api/core.rb +3 -3
- data/lib/chefspec/api/described.rb +3 -5
- data/lib/chefspec/api/include_any_recipe.rb +24 -0
- data/lib/chefspec/api/stubs.rb +2 -2
- data/lib/chefspec/api/stubs_for.rb +23 -20
- data/lib/chefspec/berkshelf.rb +4 -4
- data/lib/chefspec/cacher.rb +2 -2
- data/lib/chefspec/coverage.rb +35 -40
- data/lib/chefspec/coverage/filters.rb +18 -15
- data/lib/chefspec/deprecations.rb +3 -3
- data/lib/chefspec/errors.rb +7 -7
- data/lib/chefspec/expect_exception.rb +2 -1
- data/lib/chefspec/extensions.rb +14 -13
- data/lib/chefspec/extensions/chef/client.rb +3 -3
- data/lib/chefspec/extensions/chef/conditional.rb +2 -1
- data/lib/chefspec/extensions/chef/cookbook/gem_installer.rb +5 -4
- data/lib/chefspec/extensions/chef/cookbook_loader.rb +1 -0
- data/lib/chefspec/extensions/chef/cookbook_uploader.rb +1 -1
- data/lib/chefspec/extensions/chef/data_query.rb +3 -3
- data/lib/chefspec/extensions/chef/lwrp_base.rb +1 -0
- data/lib/chefspec/extensions/chef/provider.rb +8 -5
- data/lib/chefspec/extensions/chef/resource.rb +18 -12
- data/lib/chefspec/extensions/chef/resource/freebsd_package.rb +2 -1
- data/lib/chefspec/extensions/chef/run_context/cookbook_compiler.rb +21 -1
- data/lib/chefspec/extensions/chef/securable.rb +1 -1
- data/lib/chefspec/extensions/ohai/system.rb +11 -0
- data/lib/chefspec/file_cache_path_proxy.rb +3 -3
- data/lib/chefspec/formatter.rb +15 -3
- data/lib/chefspec/librarian.rb +7 -6
- data/lib/chefspec/matchers.rb +9 -8
- data/lib/chefspec/matchers/do_nothing_matcher.rb +15 -15
- data/lib/chefspec/matchers/include_any_recipe_matcher.rb +51 -0
- data/lib/chefspec/matchers/include_recipe_matcher.rb +1 -1
- data/lib/chefspec/matchers/link_to_matcher.rb +2 -2
- data/lib/chefspec/matchers/notifications_matcher.rb +5 -4
- data/lib/chefspec/matchers/render_file_matcher.rb +3 -3
- data/lib/chefspec/matchers/resource_matcher.rb +18 -16
- data/lib/chefspec/mixins/normalize.rb +1 -1
- data/lib/chefspec/policyfile.rb +6 -6
- data/lib/chefspec/renderer.rb +4 -4
- data/lib/chefspec/rspec.rb +1 -1
- data/lib/chefspec/runner.rb +1 -1
- data/lib/chefspec/server.rb +1 -1
- data/lib/chefspec/server_methods.rb +8 -8
- data/lib/chefspec/server_runner.rb +10 -10
- data/lib/chefspec/solo_runner.rb +26 -24
- data/lib/chefspec/stubs/command_registry.rb +1 -1
- data/lib/chefspec/stubs/command_stub.rb +1 -1
- data/lib/chefspec/stubs/data_bag_item_registry.rb +1 -1
- data/lib/chefspec/stubs/data_bag_item_stub.rb +1 -1
- data/lib/chefspec/stubs/data_bag_registry.rb +1 -1
- data/lib/chefspec/stubs/data_bag_stub.rb +1 -1
- data/lib/chefspec/stubs/registry.rb +1 -1
- data/lib/chefspec/stubs/search_registry.rb +2 -2
- data/lib/chefspec/stubs/search_stub.rb +2 -2
- data/lib/chefspec/util.rb +7 -7
- data/lib/chefspec/version.rb +1 -1
- data/lib/chefspec/zero_server.rb +4 -4
- data/spec/spec_helper.rb +3 -4
- data/spec/support/hash.rb +3 -3
- data/spec/unit/cacher_spec.rb +17 -17
- data/spec/unit/coverage/filters_spec.rb +16 -16
- data/spec/unit/deprecations_spec.rb +8 -9
- data/spec/unit/errors_spec.rb +15 -15
- data/spec/unit/expect_exception_spec.rb +9 -9
- data/spec/unit/macros_spec.rb +50 -50
- data/spec/unit/matchers/do_nothing_matcher.rb +1 -1
- data/spec/unit/matchers/include_any_recipe_matcher_spec.rb +52 -0
- data/spec/unit/matchers/include_recipe_matcher_spec.rb +15 -15
- data/spec/unit/matchers/link_to_matcher_spec.rb +18 -18
- data/spec/unit/matchers/notifications_matcher_spec.rb +15 -16
- data/spec/unit/matchers/render_file_matcher_spec.rb +26 -26
- data/spec/unit/matchers/resource_matcher_spec.rb +1 -1
- data/spec/unit/matchers/state_attrs_matcher_spec.rb +24 -24
- data/spec/unit/matchers/subscribes_matcher_spec.rb +27 -29
- data/spec/unit/renderer_spec.rb +36 -36
- data/spec/unit/server_runner_spec.rb +6 -6
- data/spec/unit/solo_runner_spec.rb +69 -69
- data/spec/unit/stubs/command_registry_spec.rb +11 -11
- data/spec/unit/stubs/command_stub_spec.rb +26 -26
- data/spec/unit/stubs/data_bag_item_registry_spec.rb +17 -17
- data/spec/unit/stubs/data_bag_item_stub_spec.rb +14 -14
- data/spec/unit/stubs/data_bag_registry_spec.rb +16 -16
- data/spec/unit/stubs/data_bag_stub_spec.rb +13 -13
- data/spec/unit/stubs/registry_spec.rb +9 -9
- data/spec/unit/stubs/search_registry_spec.rb +17 -17
- data/spec/unit/stubs/search_stub_spec.rb +14 -14
- data/spec/unit/stubs/stub_spec.rb +22 -22
- metadata +16 -12
@@ -1,62 +1,62 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
describe ChefSpec::Stubs::Stub do
|
4
|
-
describe
|
5
|
-
subject { described_class.new.and_return(
|
4
|
+
describe "#and_return" do
|
5
|
+
subject { described_class.new.and_return("value") }
|
6
6
|
|
7
|
-
it
|
8
|
-
expect(subject.value).to eq(
|
7
|
+
it "sets the value" do
|
8
|
+
expect(subject.value).to eq("value")
|
9
9
|
end
|
10
10
|
|
11
|
-
it
|
12
|
-
expect(subject.and_return(
|
11
|
+
it "returns an instance of the stub" do
|
12
|
+
expect(subject.and_return("value")).to be(subject)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
describe
|
16
|
+
describe "#and_raise" do
|
17
17
|
subject { described_class.new.and_raise(ArgumentError) }
|
18
18
|
|
19
|
-
it
|
19
|
+
it "sets the block" do
|
20
20
|
expect(subject.instance_variable_get(:@block)).to be_a(Proc)
|
21
21
|
end
|
22
22
|
|
23
|
-
it
|
23
|
+
it "returns an instance of the stub" do
|
24
24
|
expect(subject.and_raise(ArgumentError)).to be(subject)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
describe
|
29
|
-
context
|
30
|
-
subject { described_class.new.and_return(
|
28
|
+
describe "#result" do
|
29
|
+
context "when a value is given" do
|
30
|
+
subject { described_class.new.and_return("value") }
|
31
31
|
|
32
|
-
it
|
33
|
-
expect(subject.result).to eq(
|
32
|
+
it "returns the value" do
|
33
|
+
expect(subject.result).to eq("value")
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
context
|
37
|
+
context "when a block is given" do
|
38
38
|
subject { described_class.new }
|
39
39
|
|
40
|
-
it
|
40
|
+
it "calls the block" do
|
41
41
|
subject.instance_variable_set(:@block, Proc.new { 1 == 2 })
|
42
42
|
expect(subject.result).to eq(false)
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
context
|
46
|
+
context "when an exception block is given" do
|
47
47
|
subject { described_class.new.and_raise(ArgumentError) }
|
48
48
|
|
49
|
-
it
|
49
|
+
it "raises the exception" do
|
50
50
|
expect {
|
51
51
|
subject.result
|
52
52
|
}.to raise_error(ArgumentError)
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
-
context
|
57
|
-
subject { described_class.new.and_return([ { name:
|
56
|
+
context "when the value is a Hash" do
|
57
|
+
subject { described_class.new.and_return([ { name: "a" } ]) }
|
58
58
|
|
59
|
-
it
|
59
|
+
it "recursively mashifies the value" do
|
60
60
|
expect(subject.result.first).to be_a(Mash)
|
61
61
|
end
|
62
62
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chefspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 9.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Crump
|
8
8
|
- Seth Vargo
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-05-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: chef
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
20
|
+
version: '15'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: '
|
27
|
+
version: '15'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: chef-cli
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -40,19 +40,19 @@ dependencies:
|
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '0'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
|
-
name: fauxhai
|
43
|
+
name: fauxhai-ng
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
46
|
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: '
|
48
|
+
version: '7.5'
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: '
|
55
|
+
version: '7.5'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: rspec
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,6 +86,7 @@ files:
|
|
86
86
|
- lib/chefspec/api/core.rb
|
87
87
|
- lib/chefspec/api/described.rb
|
88
88
|
- lib/chefspec/api/do_nothing.rb
|
89
|
+
- lib/chefspec/api/include_any_recipe.rb
|
89
90
|
- lib/chefspec/api/include_recipe.rb
|
90
91
|
- lib/chefspec/api/link.rb
|
91
92
|
- lib/chefspec/api/notifications.rb
|
@@ -118,11 +119,13 @@ files:
|
|
118
119
|
- lib/chefspec/extensions/chef/resource/freebsd_package.rb
|
119
120
|
- lib/chefspec/extensions/chef/run_context/cookbook_compiler.rb
|
120
121
|
- lib/chefspec/extensions/chef/securable.rb
|
122
|
+
- lib/chefspec/extensions/ohai/system.rb
|
121
123
|
- lib/chefspec/file_cache_path_proxy.rb
|
122
124
|
- lib/chefspec/formatter.rb
|
123
125
|
- lib/chefspec/librarian.rb
|
124
126
|
- lib/chefspec/matchers.rb
|
125
127
|
- lib/chefspec/matchers/do_nothing_matcher.rb
|
128
|
+
- lib/chefspec/matchers/include_any_recipe_matcher.rb
|
126
129
|
- lib/chefspec/matchers/include_recipe_matcher.rb
|
127
130
|
- lib/chefspec/matchers/link_to_matcher.rb
|
128
131
|
- lib/chefspec/matchers/notifications_matcher.rb
|
@@ -161,6 +164,7 @@ files:
|
|
161
164
|
- spec/unit/expect_exception_spec.rb
|
162
165
|
- spec/unit/macros_spec.rb
|
163
166
|
- spec/unit/matchers/do_nothing_matcher.rb
|
167
|
+
- spec/unit/matchers/include_any_recipe_matcher_spec.rb
|
164
168
|
- spec/unit/matchers/include_recipe_matcher_spec.rb
|
165
169
|
- spec/unit/matchers/link_to_matcher_spec.rb
|
166
170
|
- spec/unit/matchers/notifications_matcher_spec.rb
|
@@ -197,7 +201,7 @@ homepage: https://github.com/chefspec/chefspec
|
|
197
201
|
licenses:
|
198
202
|
- MIT
|
199
203
|
metadata: {}
|
200
|
-
post_install_message:
|
204
|
+
post_install_message:
|
201
205
|
rdoc_options: []
|
202
206
|
require_paths:
|
203
207
|
- lib
|
@@ -205,15 +209,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
205
209
|
requirements:
|
206
210
|
- - ">="
|
207
211
|
- !ruby/object:Gem::Version
|
208
|
-
version: '2.
|
212
|
+
version: '2.5'
|
209
213
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
210
214
|
requirements:
|
211
215
|
- - ">="
|
212
216
|
- !ruby/object:Gem::Version
|
213
217
|
version: '0'
|
214
218
|
requirements: []
|
215
|
-
rubygems_version: 3.
|
216
|
-
signing_key:
|
219
|
+
rubygems_version: 3.2.15
|
220
|
+
signing_key:
|
217
221
|
specification_version: 4
|
218
222
|
summary: Write RSpec examples and generate coverage reports for Chef recipes!
|
219
223
|
test_files: []
|