chefspec 9.0.0 → 9.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +16 -9
- data/Rakefile +60 -52
- data/chefspec.gemspec +27 -20
- 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/api.rb +15 -13
- data/lib/chefspec/berkshelf.rb +4 -4
- data/lib/chefspec/cacher.rb +2 -2
- data/lib/chefspec/coverage/filters.rb +18 -15
- data/lib/chefspec/coverage.rb +35 -40
- 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/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/freebsd_package.rb +2 -1
- data/lib/chefspec/extensions/chef/resource.rb +18 -12
- 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/extensions.rb +14 -13
- 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/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/matchers.rb +9 -8
- data/lib/chefspec/mixins/normalize.rb +1 -1
- data/lib/chefspec/policyfile.rb +11 -7
- 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 +27 -25
- 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/lib/chefspec.rb +29 -29
- data/spec/spec_helper.rb +3 -4
- data/spec/support/hash.rb +4 -4
- 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 +42 -12
- data/lib/chefspec/extensions/.DS_Store +0 -0
- data/lib/chefspec/extensions/chef/.DS_Store +0 -0
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "spec_helper"
|
|
2
2
|
|
|
3
3
|
describe ChefSpec::Stubs::DataBagItemRegistry do
|
|
4
4
|
before { described_class.reset! }
|
|
5
5
|
|
|
6
|
-
it
|
|
6
|
+
it "inherits from Registry" do
|
|
7
7
|
expect(described_class.superclass).to be(ChefSpec::Stubs::Registry)
|
|
8
8
|
end
|
|
9
9
|
|
|
10
|
-
describe
|
|
11
|
-
it
|
|
12
|
-
search = double(
|
|
10
|
+
describe "#stub_for" do
|
|
11
|
+
it "finds a stub by name" do
|
|
12
|
+
search = double("search", bag: "users", id: "svargo")
|
|
13
13
|
described_class.register(search)
|
|
14
|
-
expect(described_class.stub_for(
|
|
14
|
+
expect(described_class.stub_for("users", "svargo")).to eq(search)
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
it
|
|
18
|
-
search = double(
|
|
17
|
+
it "finds a stub by Regex" do
|
|
18
|
+
search = double("search", bag: "users", id: /sv(.+)/)
|
|
19
19
|
described_class.register(search)
|
|
20
|
-
expect(described_class.stub_for(
|
|
20
|
+
expect(described_class.stub_for("users", "svargo")).to eq(search)
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
it
|
|
24
|
-
search = double(
|
|
23
|
+
it "matches when the bag is a Symbol" do
|
|
24
|
+
search = double("search", bag: :users, id: "svargo")
|
|
25
25
|
described_class.register(search)
|
|
26
|
-
expect(described_class.stub_for(
|
|
26
|
+
expect(described_class.stub_for("users", "svargo")).to eq(search)
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
-
it
|
|
30
|
-
search = double(
|
|
29
|
+
it "matches when the stub is a Symbol" do
|
|
30
|
+
search = double("search", bag: "users", id: "svargo")
|
|
31
31
|
described_class.register(search)
|
|
32
|
-
expect(described_class.stub_for(:users,
|
|
32
|
+
expect(described_class.stub_for(:users, "svargo")).to eq(search)
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
-
it
|
|
36
|
-
expect(described_class.stub_for(
|
|
35
|
+
it "returns nil when no searches are matched" do
|
|
36
|
+
expect(described_class.stub_for("users", "svargo")).to eq(nil)
|
|
37
37
|
end
|
|
38
38
|
end
|
|
39
39
|
end
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "spec_helper"
|
|
2
2
|
|
|
3
3
|
describe ChefSpec::Stubs::DataBagItemStub do
|
|
4
|
-
it
|
|
4
|
+
it "inherts from Stub" do
|
|
5
5
|
expect(described_class.superclass).to be(ChefSpec::Stubs::Stub)
|
|
6
6
|
end
|
|
7
7
|
|
|
8
|
-
describe
|
|
9
|
-
it
|
|
8
|
+
describe "#initialize" do
|
|
9
|
+
it "sets the bag, id, and block" do
|
|
10
10
|
block = Proc.new {}
|
|
11
|
-
stub = described_class.new(
|
|
11
|
+
stub = described_class.new("bag", "id", &block)
|
|
12
12
|
|
|
13
|
-
expect(stub.bag).to eq(
|
|
14
|
-
expect(stub.id).to eq(
|
|
13
|
+
expect(stub.bag).to eq("bag")
|
|
14
|
+
expect(stub.id).to eq("id")
|
|
15
15
|
expect(stub.block).to eq(block)
|
|
16
16
|
end
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
describe
|
|
20
|
-
context
|
|
21
|
-
subject { described_class.new(
|
|
19
|
+
describe "#signature" do
|
|
20
|
+
context "when a value is given" do
|
|
21
|
+
subject { described_class.new("bag", "id").and_return(false) }
|
|
22
22
|
|
|
23
|
-
it
|
|
23
|
+
it "includes the value" do
|
|
24
24
|
expect(subject.signature).to eq('stub_data_bag_item("bag", "id").and_return(false)')
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
-
context
|
|
29
|
-
subject { described_class.new(
|
|
28
|
+
context "when a block is given" do
|
|
29
|
+
subject { described_class.new("bag", "id") { 1 == 2 } }
|
|
30
30
|
|
|
31
|
-
it
|
|
31
|
+
it "includes a comment about the block" do
|
|
32
32
|
expect(subject.signature).to eq('stub_data_bag_item("bag", "id") { # Ruby code }')
|
|
33
33
|
end
|
|
34
34
|
end
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "spec_helper"
|
|
2
2
|
|
|
3
3
|
describe ChefSpec::Stubs::DataBagRegistry do
|
|
4
4
|
before { described_class.reset! }
|
|
5
5
|
|
|
6
|
-
it
|
|
6
|
+
it "inherits from Registry" do
|
|
7
7
|
expect(described_class.superclass).to be(ChefSpec::Stubs::Registry)
|
|
8
8
|
end
|
|
9
9
|
|
|
10
|
-
describe
|
|
11
|
-
it
|
|
12
|
-
search = double(
|
|
10
|
+
describe "#stub_for" do
|
|
11
|
+
it "finds a stub by name" do
|
|
12
|
+
search = double("search", bag: "users")
|
|
13
13
|
described_class.register(search)
|
|
14
|
-
expect(described_class.stub_for(
|
|
14
|
+
expect(described_class.stub_for("users")).to eq(search)
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
it
|
|
18
|
-
search = double(
|
|
17
|
+
it "finds a stub by Regex" do
|
|
18
|
+
search = double("search", bag: "users")
|
|
19
19
|
described_class.register(search)
|
|
20
|
-
expect(described_class.stub_for(
|
|
20
|
+
expect(described_class.stub_for("users")).to eq(search)
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
it
|
|
24
|
-
search = double(
|
|
23
|
+
it "matches when the bag is Symbol" do
|
|
24
|
+
search = double("search", bag: :users)
|
|
25
25
|
described_class.register(search)
|
|
26
|
-
expect(described_class.stub_for(
|
|
26
|
+
expect(described_class.stub_for("users")).to eq(search)
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
-
it
|
|
30
|
-
search = double(
|
|
29
|
+
it "matches when the stub is Symbol" do
|
|
30
|
+
search = double("search", bag: "users")
|
|
31
31
|
described_class.register(search)
|
|
32
32
|
expect(described_class.stub_for(:users)).to eq(search)
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
-
it
|
|
36
|
-
expect(described_class.stub_for(
|
|
35
|
+
it "returns nil when no searches are matched" do
|
|
36
|
+
expect(described_class.stub_for("users")).to eq(nil)
|
|
37
37
|
end
|
|
38
38
|
end
|
|
39
39
|
end
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "spec_helper"
|
|
2
2
|
|
|
3
3
|
describe ChefSpec::Stubs::DataBagStub do
|
|
4
|
-
it
|
|
4
|
+
it "inherts from Stub" do
|
|
5
5
|
expect(described_class.superclass).to be(ChefSpec::Stubs::Stub)
|
|
6
6
|
end
|
|
7
7
|
|
|
8
|
-
describe
|
|
9
|
-
it
|
|
8
|
+
describe "#initialize" do
|
|
9
|
+
it "sets the bag and block" do
|
|
10
10
|
block = Proc.new {}
|
|
11
|
-
stub = described_class.new(
|
|
11
|
+
stub = described_class.new("bag", &block)
|
|
12
12
|
|
|
13
|
-
expect(stub.bag).to eq(
|
|
13
|
+
expect(stub.bag).to eq("bag")
|
|
14
14
|
expect(stub.block).to eq(block)
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
describe
|
|
19
|
-
context
|
|
20
|
-
subject { described_class.new(
|
|
18
|
+
describe "#signature" do
|
|
19
|
+
context "when a value is given" do
|
|
20
|
+
subject { described_class.new("bag").and_return(false) }
|
|
21
21
|
|
|
22
|
-
it
|
|
22
|
+
it "includes the value" do
|
|
23
23
|
expect(subject.signature).to eq('stub_data_bag("bag").and_return(false)')
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
-
context
|
|
28
|
-
subject { described_class.new(
|
|
27
|
+
context "when a block is given" do
|
|
28
|
+
subject { described_class.new("bag") { 1 == 2 } }
|
|
29
29
|
|
|
30
|
-
it
|
|
30
|
+
it "includes a comment about the block" do
|
|
31
31
|
expect(subject.signature).to eq('stub_data_bag("bag") { # Ruby code }')
|
|
32
32
|
end
|
|
33
33
|
end
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "spec_helper"
|
|
2
2
|
|
|
3
3
|
describe ChefSpec::Stubs::Registry do
|
|
4
4
|
before { described_class.reset! }
|
|
5
5
|
|
|
6
|
-
describe
|
|
7
|
-
it
|
|
6
|
+
describe "#reset!" do
|
|
7
|
+
it "cleans the list of stubs" do
|
|
8
8
|
described_class.stubs = [1, 2, 3]
|
|
9
9
|
described_class.reset!
|
|
10
10
|
|
|
@@ -12,15 +12,15 @@ describe ChefSpec::Stubs::Registry do
|
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
describe
|
|
16
|
-
it
|
|
17
|
-
described_class.register(
|
|
18
|
-
expect(described_class.stubs).to include(
|
|
15
|
+
describe "#register" do
|
|
16
|
+
it "adds the stub to the registry" do
|
|
17
|
+
described_class.register("bacon")
|
|
18
|
+
expect(described_class.stubs).to include("bacon")
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
describe
|
|
23
|
-
it
|
|
22
|
+
describe "#stub_for" do
|
|
23
|
+
it "finds a stub by name" do
|
|
24
24
|
expect {
|
|
25
25
|
described_class.stub_for
|
|
26
26
|
}.to raise_error(ArgumentError)
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "spec_helper"
|
|
2
2
|
|
|
3
3
|
describe ChefSpec::Stubs::SearchRegistry do
|
|
4
4
|
before { described_class.reset! }
|
|
5
5
|
|
|
6
|
-
it
|
|
6
|
+
it "inherits from Registry" do
|
|
7
7
|
expect(described_class.superclass).to be(ChefSpec::Stubs::Registry)
|
|
8
8
|
end
|
|
9
9
|
|
|
10
|
-
describe
|
|
11
|
-
it
|
|
12
|
-
search = double(
|
|
10
|
+
describe "#stub_for" do
|
|
11
|
+
it "finds a stub by name" do
|
|
12
|
+
search = double("search", type: "node", query: "*:*")
|
|
13
13
|
described_class.register(search)
|
|
14
|
-
expect(described_class.stub_for(
|
|
14
|
+
expect(described_class.stub_for("node", "*:*")).to eq(search)
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
it
|
|
18
|
-
search = double(
|
|
17
|
+
it "finds a stub by Regex" do
|
|
18
|
+
search = double("search", type: "node", query: /name:(.+)/)
|
|
19
19
|
described_class.register(search)
|
|
20
|
-
expect(described_class.stub_for(
|
|
20
|
+
expect(described_class.stub_for("node", "name:example.com")).to eq(search)
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
it
|
|
24
|
-
search = double(
|
|
23
|
+
it "matches when the type is Symbol" do
|
|
24
|
+
search = double("search", type: :node, query: "*:*")
|
|
25
25
|
described_class.register(search)
|
|
26
|
-
expect(described_class.stub_for(
|
|
26
|
+
expect(described_class.stub_for("node", "*:*")).to eq(search)
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
-
it
|
|
30
|
-
search = double(
|
|
29
|
+
it "matches when the stub is Symbol" do
|
|
30
|
+
search = double("search", type: "node", query: "*:*")
|
|
31
31
|
described_class.register(search)
|
|
32
|
-
expect(described_class.stub_for(:node,
|
|
32
|
+
expect(described_class.stub_for(:node, "*:*")).to eq(search)
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
-
it
|
|
36
|
-
expect(described_class.stub_for(
|
|
35
|
+
it "returns nil when no searches are matched" do
|
|
36
|
+
expect(described_class.stub_for("node", "name:example.com")).to eq(nil)
|
|
37
37
|
end
|
|
38
38
|
end
|
|
39
39
|
end
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "spec_helper"
|
|
2
2
|
|
|
3
3
|
describe ChefSpec::Stubs::SearchStub do
|
|
4
|
-
it
|
|
4
|
+
it "inherts from Stub" do
|
|
5
5
|
expect(described_class.superclass).to be(ChefSpec::Stubs::Stub)
|
|
6
6
|
end
|
|
7
7
|
|
|
8
|
-
describe
|
|
9
|
-
it
|
|
8
|
+
describe "#initialize" do
|
|
9
|
+
it "sets the type, query, and block" do
|
|
10
10
|
block = Proc.new {}
|
|
11
|
-
stub = described_class.new(
|
|
11
|
+
stub = described_class.new("type", "query", &block)
|
|
12
12
|
|
|
13
|
-
expect(stub.type).to eq(
|
|
14
|
-
expect(stub.query).to eq(
|
|
13
|
+
expect(stub.type).to eq("type")
|
|
14
|
+
expect(stub.query).to eq("query")
|
|
15
15
|
expect(stub.block).to eq(block)
|
|
16
16
|
end
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
describe
|
|
20
|
-
context
|
|
21
|
-
subject { described_class.new(
|
|
19
|
+
describe "#signature" do
|
|
20
|
+
context "when a value is given" do
|
|
21
|
+
subject { described_class.new("type", "query").and_return(false) }
|
|
22
22
|
|
|
23
|
-
it
|
|
23
|
+
it "includes the value" do
|
|
24
24
|
expect(subject.signature).to eq('stub_search("type", "query").and_return(false)')
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
-
context
|
|
29
|
-
subject { described_class.new(
|
|
28
|
+
context "when a block is given" do
|
|
29
|
+
subject { described_class.new("type", "query") { 1 == 2 } }
|
|
30
30
|
|
|
31
|
-
it
|
|
31
|
+
it "includes a comment about the block" do
|
|
32
32
|
expect(subject.signature).to eq('stub_search("type", "query") { # Ruby code }')
|
|
33
33
|
end
|
|
34
34
|
end
|
|
@@ -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,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: chefspec
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 9.
|
|
4
|
+
version: 9.3.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrew Crump
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2024-07-16 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-chef
|
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
|
45
45
|
requirements:
|
|
46
46
|
- - ">="
|
|
47
47
|
- !ruby/object:Gem::Version
|
|
48
|
-
version: '
|
|
48
|
+
version: '9.3'
|
|
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: '9.3'
|
|
56
56
|
- !ruby/object:Gem::Dependency
|
|
57
57
|
name: rspec
|
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -67,6 +67,34 @@ dependencies:
|
|
|
67
67
|
- - "~>"
|
|
68
68
|
- !ruby/object:Gem::Version
|
|
69
69
|
version: '3.0'
|
|
70
|
+
- !ruby/object:Gem::Dependency
|
|
71
|
+
name: logger
|
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
|
73
|
+
requirements:
|
|
74
|
+
- - "<"
|
|
75
|
+
- !ruby/object:Gem::Version
|
|
76
|
+
version: '1.6'
|
|
77
|
+
type: :runtime
|
|
78
|
+
prerelease: false
|
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
80
|
+
requirements:
|
|
81
|
+
- - "<"
|
|
82
|
+
- !ruby/object:Gem::Version
|
|
83
|
+
version: '1.6'
|
|
84
|
+
- !ruby/object:Gem::Dependency
|
|
85
|
+
name: rspec-expectations
|
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
|
87
|
+
requirements:
|
|
88
|
+
- - "<="
|
|
89
|
+
- !ruby/object:Gem::Version
|
|
90
|
+
version: 3.12.3
|
|
91
|
+
type: :runtime
|
|
92
|
+
prerelease: false
|
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
94
|
+
requirements:
|
|
95
|
+
- - "<="
|
|
96
|
+
- !ruby/object:Gem::Version
|
|
97
|
+
version: 3.12.3
|
|
70
98
|
description: ChefSpec is a unit testing and resource coverage (code coverage) framework
|
|
71
99
|
for testing Chef cookbooks ChefSpec makes it easy to write examples and get fast
|
|
72
100
|
feedback on cookbook changes without the need for virtual machines or cloud servers.
|
|
@@ -86,6 +114,7 @@ files:
|
|
|
86
114
|
- lib/chefspec/api/core.rb
|
|
87
115
|
- lib/chefspec/api/described.rb
|
|
88
116
|
- lib/chefspec/api/do_nothing.rb
|
|
117
|
+
- lib/chefspec/api/include_any_recipe.rb
|
|
89
118
|
- lib/chefspec/api/include_recipe.rb
|
|
90
119
|
- lib/chefspec/api/link.rb
|
|
91
120
|
- lib/chefspec/api/notifications.rb
|
|
@@ -104,8 +133,6 @@ files:
|
|
|
104
133
|
- lib/chefspec/errors.rb
|
|
105
134
|
- lib/chefspec/expect_exception.rb
|
|
106
135
|
- lib/chefspec/extensions.rb
|
|
107
|
-
- lib/chefspec/extensions/.DS_Store
|
|
108
|
-
- lib/chefspec/extensions/chef/.DS_Store
|
|
109
136
|
- lib/chefspec/extensions/chef/client.rb
|
|
110
137
|
- lib/chefspec/extensions/chef/conditional.rb
|
|
111
138
|
- lib/chefspec/extensions/chef/cookbook/gem_installer.rb
|
|
@@ -118,11 +145,13 @@ files:
|
|
|
118
145
|
- lib/chefspec/extensions/chef/resource/freebsd_package.rb
|
|
119
146
|
- lib/chefspec/extensions/chef/run_context/cookbook_compiler.rb
|
|
120
147
|
- lib/chefspec/extensions/chef/securable.rb
|
|
148
|
+
- lib/chefspec/extensions/ohai/system.rb
|
|
121
149
|
- lib/chefspec/file_cache_path_proxy.rb
|
|
122
150
|
- lib/chefspec/formatter.rb
|
|
123
151
|
- lib/chefspec/librarian.rb
|
|
124
152
|
- lib/chefspec/matchers.rb
|
|
125
153
|
- lib/chefspec/matchers/do_nothing_matcher.rb
|
|
154
|
+
- lib/chefspec/matchers/include_any_recipe_matcher.rb
|
|
126
155
|
- lib/chefspec/matchers/include_recipe_matcher.rb
|
|
127
156
|
- lib/chefspec/matchers/link_to_matcher.rb
|
|
128
157
|
- lib/chefspec/matchers/notifications_matcher.rb
|
|
@@ -161,6 +190,7 @@ files:
|
|
|
161
190
|
- spec/unit/expect_exception_spec.rb
|
|
162
191
|
- spec/unit/macros_spec.rb
|
|
163
192
|
- spec/unit/matchers/do_nothing_matcher.rb
|
|
193
|
+
- spec/unit/matchers/include_any_recipe_matcher_spec.rb
|
|
164
194
|
- spec/unit/matchers/include_recipe_matcher_spec.rb
|
|
165
195
|
- spec/unit/matchers/link_to_matcher_spec.rb
|
|
166
196
|
- spec/unit/matchers/notifications_matcher_spec.rb
|
|
@@ -193,7 +223,7 @@ files:
|
|
|
193
223
|
- templates/errors/not_stubbed.erb
|
|
194
224
|
- templates/errors/shell_out_not_stubbed.erb
|
|
195
225
|
- templates/errors/template_not_found.erb
|
|
196
|
-
homepage: https://github.com/
|
|
226
|
+
homepage: https://github.com/chef/chefspec
|
|
197
227
|
licenses:
|
|
198
228
|
- MIT
|
|
199
229
|
metadata: {}
|
|
@@ -205,14 +235,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
205
235
|
requirements:
|
|
206
236
|
- - ">="
|
|
207
237
|
- !ruby/object:Gem::Version
|
|
208
|
-
version: '2.
|
|
238
|
+
version: '2.5'
|
|
209
239
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
210
240
|
requirements:
|
|
211
241
|
- - ">="
|
|
212
242
|
- !ruby/object:Gem::Version
|
|
213
243
|
version: '0'
|
|
214
244
|
requirements: []
|
|
215
|
-
rubygems_version: 3.
|
|
245
|
+
rubygems_version: 3.2.3
|
|
216
246
|
signing_key:
|
|
217
247
|
specification_version: 4
|
|
218
248
|
summary: Write RSpec examples and generate coverage reports for Chef recipes!
|
|
Binary file
|
|
Binary file
|