chef-utils 18.0.172 → 18.0.185

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +201 -201
  3. data/Rakefile +15 -15
  4. data/chef-utils.gemspec +50 -50
  5. data/lib/chef-utils/dist.rb +154 -154
  6. data/lib/chef-utils/dsl/architecture.rb +150 -150
  7. data/lib/chef-utils/dsl/cloud.rb +155 -155
  8. data/lib/chef-utils/dsl/default_paths.rb +60 -60
  9. data/lib/chef-utils/dsl/introspection.rb +134 -134
  10. data/lib/chef-utils/dsl/os.rb +58 -58
  11. data/lib/chef-utils/dsl/path_sanity.rb +39 -39
  12. data/lib/chef-utils/dsl/platform.rb +387 -387
  13. data/lib/chef-utils/dsl/platform_family.rb +360 -360
  14. data/lib/chef-utils/dsl/platform_version.rb +41 -41
  15. data/lib/chef-utils/dsl/service.rb +112 -112
  16. data/lib/chef-utils/dsl/train_helpers.rb +87 -87
  17. data/lib/chef-utils/dsl/virtualization.rb +272 -272
  18. data/lib/chef-utils/dsl/which.rb +123 -123
  19. data/lib/chef-utils/dsl/windows.rb +86 -86
  20. data/lib/chef-utils/internal.rb +114 -114
  21. data/lib/chef-utils/mash.rb +263 -263
  22. data/lib/chef-utils/parallel_map.rb +131 -131
  23. data/lib/chef-utils/version.rb +20 -20
  24. data/lib/chef-utils/version_string.rb +160 -160
  25. data/lib/chef-utils.rb +53 -53
  26. data/spec/spec_helper.rb +100 -100
  27. data/spec/unit/dsl/architecture_spec.rb +151 -151
  28. data/spec/unit/dsl/cloud_spec.rb +93 -93
  29. data/spec/unit/dsl/dsl_spec.rb +34 -34
  30. data/spec/unit/dsl/introspection_spec.rb +201 -201
  31. data/spec/unit/dsl/os_spec.rb +175 -175
  32. data/spec/unit/dsl/path_sanity_spec.rb +86 -86
  33. data/spec/unit/dsl/platform_family_spec.rb +235 -235
  34. data/spec/unit/dsl/platform_spec.rb +252 -252
  35. data/spec/unit/dsl/service_spec.rb +117 -117
  36. data/spec/unit/dsl/virtualization_spec.rb +75 -75
  37. data/spec/unit/dsl/which_spec.rb +171 -171
  38. data/spec/unit/dsl/windows_spec.rb +84 -84
  39. data/spec/unit/mash_spec.rb +51 -51
  40. data/spec/unit/parallel_map_spec.rb +156 -156
  41. metadata +7 -7
data/lib/chef-utils.rb CHANGED
@@ -1,53 +1,53 @@
1
- # frozen_string_literal: true
2
- #
3
- # Copyright:: Copyright (c) Chef Software Inc.
4
- # License:: Apache License, Version 2.0
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
- require_relative "chef-utils/dsl/architecture"
20
- require_relative "chef-utils/dsl/cloud"
21
- require_relative "chef-utils/dsl/introspection"
22
- require_relative "chef-utils/dsl/os"
23
- require_relative "chef-utils/dsl/default_paths"
24
- require_relative "chef-utils/dsl/path_sanity"
25
- require_relative "chef-utils/dsl/platform"
26
- require_relative "chef-utils/dsl/platform_family"
27
- require_relative "chef-utils/dsl/platform_version"
28
- require_relative "chef-utils/dsl/service"
29
- require_relative "chef-utils/dsl/train_helpers"
30
- require_relative "chef-utils/dsl/virtualization"
31
- require_relative "chef-utils/dsl/which"
32
- require_relative "chef-utils/dsl/windows"
33
- require_relative "chef-utils/mash"
34
-
35
- # This is the Chef Infra Client DSL, not everything needs to go in here
36
- module ChefUtils
37
- include ChefUtils::DSL::Architecture
38
- include ChefUtils::DSL::Cloud
39
- include ChefUtils::DSL::DefaultPaths
40
- include ChefUtils::DSL::Introspection
41
- include ChefUtils::DSL::OS
42
- include ChefUtils::DSL::Platform
43
- include ChefUtils::DSL::PlatformFamily
44
- include ChefUtils::DSL::PlatformVersion
45
- include ChefUtils::DSL::TrainHelpers
46
- include ChefUtils::DSL::Virtualization
47
- include ChefUtils::DSL::Which
48
- include ChefUtils::DSL::Windows
49
- # ChefUtils::DSL::Service is deliberately excluded
50
-
51
- CANARY = 1 # used as a guard for requires
52
- extend self
53
- end
1
+ # frozen_string_literal: true
2
+ #
3
+ # Copyright:: Copyright (c) Chef Software Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require_relative "chef-utils/dsl/architecture"
20
+ require_relative "chef-utils/dsl/cloud"
21
+ require_relative "chef-utils/dsl/introspection"
22
+ require_relative "chef-utils/dsl/os"
23
+ require_relative "chef-utils/dsl/default_paths"
24
+ require_relative "chef-utils/dsl/path_sanity"
25
+ require_relative "chef-utils/dsl/platform"
26
+ require_relative "chef-utils/dsl/platform_family"
27
+ require_relative "chef-utils/dsl/platform_version"
28
+ require_relative "chef-utils/dsl/service"
29
+ require_relative "chef-utils/dsl/train_helpers"
30
+ require_relative "chef-utils/dsl/virtualization"
31
+ require_relative "chef-utils/dsl/which"
32
+ require_relative "chef-utils/dsl/windows"
33
+ require_relative "chef-utils/mash"
34
+
35
+ # This is the Chef Infra Client DSL, not everything needs to go in here
36
+ module ChefUtils
37
+ include ChefUtils::DSL::Architecture
38
+ include ChefUtils::DSL::Cloud
39
+ include ChefUtils::DSL::DefaultPaths
40
+ include ChefUtils::DSL::Introspection
41
+ include ChefUtils::DSL::OS
42
+ include ChefUtils::DSL::Platform
43
+ include ChefUtils::DSL::PlatformFamily
44
+ include ChefUtils::DSL::PlatformVersion
45
+ include ChefUtils::DSL::TrainHelpers
46
+ include ChefUtils::DSL::Virtualization
47
+ include ChefUtils::DSL::Which
48
+ include ChefUtils::DSL::Windows
49
+ # ChefUtils::DSL::Service is deliberately excluded
50
+
51
+ CANARY = 1 # used as a guard for requires
52
+ extend self
53
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,100 +1,100 @@
1
- # frozen_string_literal: true
2
- require "chef-utils"
3
-
4
- # FIXME: dynamically generate this for accuracy
5
- HELPER_MODULES = [
6
- ChefUtils::DSL::Architecture,
7
- ChefUtils::DSL::Cloud,
8
- ChefUtils::DSL::Introspection,
9
- ChefUtils::DSL::OS,
10
- ChefUtils::DSL::DefaultPaths,
11
- ChefUtils::DSL::Platform,
12
- ChefUtils::DSL::PlatformFamily,
13
- ChefUtils::DSL::Service,
14
- ChefUtils::DSL::Virtualization,
15
- ChefUtils::DSL::Which,
16
- ChefUtils::DSL::Windows,
17
- ].freeze
18
-
19
- ARCH_HELPERS = (ChefUtils::DSL::Architecture.methods - Module.methods).freeze
20
- CLOUD_HELPERS = (ChefUtils::DSL::Cloud.methods - Module.methods).freeze
21
- INTROSPECTION_HELPERS = (ChefUtils::DSL::Introspection.methods - Module.methods).freeze
22
- OS_HELPERS = (ChefUtils::DSL::OS.methods - Module.methods).freeze
23
- PLATFORM_FAMILY_HELPERS = (ChefUtils::DSL::PlatformFamily.methods - Module.methods).freeze
24
- PLATFORM_HELPERS = (ChefUtils::DSL::Platform.methods - Module.methods).freeze
25
- VIRTUALIZATION_HELPERS = (ChefUtils::DSL::Virtualization.methods - Module.methods).freeze
26
- WINDOWS_HELPERS = (ChefUtils::DSL::Windows.methods - Module.methods).freeze
27
-
28
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
29
- RSpec.configure do |config|
30
- # rspec-expectations config goes here. You can use an alternate
31
- # assertion/expectation library such as wrong or the stdlib/minitest
32
- # assertions if you prefer.
33
- config.expect_with :rspec do |expectations|
34
- # This option will default to `true` in RSpec 4. It makes the `description`
35
- # and `failure_message` of custom matchers include text for helper methods
36
- # defined using `chain`, e.g.:
37
- # be_bigger_than(2).and_smaller_than(4).description
38
- # # => "be bigger than 2 and smaller than 4"
39
- # ...rather than:
40
- # # => "be bigger than 2"
41
- expectations.include_chain_clauses_in_custom_matcher_descriptions = true
42
- end
43
-
44
- # rspec-mocks config goes here. You can use an alternate test double
45
- # library (such as bogus or mocha) by changing the `mock_with` option here.
46
- config.mock_with :rspec do |mocks|
47
- # Prevents you from mocking or stubbing a method that does not exist on
48
- # a real object. This is generally recommended, and will default to
49
- # `true` in RSpec 4.
50
- mocks.verify_partial_doubles = true
51
- end
52
-
53
- # These two settings work together to allow you to limit a spec run
54
- # to individual examples or groups you care about by tagging them with
55
- # `:focus` metadata. When nothing is tagged with `:focus`, all examples
56
- # get run.
57
- config.filter_run :focus
58
- config.run_all_when_everything_filtered = true
59
-
60
- config.filter_run_excluding windows_only: true unless ChefUtils.windows?
61
- config.filter_run_excluding unix_only: true if ChefUtils.windows?
62
-
63
- # Limits the available syntax to the non-monkey patched syntax that is
64
- # recommended. For more details, see:
65
- # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
66
- # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
67
- # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
68
- config.disable_monkey_patching!
69
-
70
- # This setting enables warnings. It's recommended, but in some cases may
71
- # be too noisy due to issues in dependencies.
72
- config.warnings = true
73
-
74
- # Many RSpec users commonly either run the entire suite or an individual
75
- # file, and it's useful to allow more verbose output when running an
76
- # individual spec file.
77
- if config.files_to_run.one?
78
- # Use the documentation formatter for detailed output,
79
- # unless a formatter has already been configured
80
- # (e.g. via a command-line flag).
81
- config.default_formatter = "doc"
82
- end
83
-
84
- # Print the 10 slowest examples and example groups at the
85
- # end of the spec run, to help surface which specs are running
86
- # particularly slow.
87
- # config.profile_examples = 10
88
-
89
- # Run specs in random order to surface order dependencies. If you find an
90
- # order dependency and want to debug it, you can fix the order by providing
91
- # the seed, which is printed after each run.
92
- # --seed 1234
93
- config.order = :random
94
-
95
- # Seed global randomization in this process using the `--seed` CLI option.
96
- # Setting this allows you to use `--seed` to deterministically reproduce
97
- # test failures related to randomization by passing the same `--seed` value
98
- # as the one that triggered the failure.
99
- Kernel.srand config.seed
100
- end
1
+ # frozen_string_literal: true
2
+ require "chef-utils"
3
+
4
+ # FIXME: dynamically generate this for accuracy
5
+ HELPER_MODULES = [
6
+ ChefUtils::DSL::Architecture,
7
+ ChefUtils::DSL::Cloud,
8
+ ChefUtils::DSL::Introspection,
9
+ ChefUtils::DSL::OS,
10
+ ChefUtils::DSL::DefaultPaths,
11
+ ChefUtils::DSL::Platform,
12
+ ChefUtils::DSL::PlatformFamily,
13
+ ChefUtils::DSL::Service,
14
+ ChefUtils::DSL::Virtualization,
15
+ ChefUtils::DSL::Which,
16
+ ChefUtils::DSL::Windows,
17
+ ].freeze
18
+
19
+ ARCH_HELPERS = (ChefUtils::DSL::Architecture.methods - Module.methods).freeze
20
+ CLOUD_HELPERS = (ChefUtils::DSL::Cloud.methods - Module.methods).freeze
21
+ INTROSPECTION_HELPERS = (ChefUtils::DSL::Introspection.methods - Module.methods).freeze
22
+ OS_HELPERS = (ChefUtils::DSL::OS.methods - Module.methods).freeze
23
+ PLATFORM_FAMILY_HELPERS = (ChefUtils::DSL::PlatformFamily.methods - Module.methods).freeze
24
+ PLATFORM_HELPERS = (ChefUtils::DSL::Platform.methods - Module.methods).freeze
25
+ VIRTUALIZATION_HELPERS = (ChefUtils::DSL::Virtualization.methods - Module.methods).freeze
26
+ WINDOWS_HELPERS = (ChefUtils::DSL::Windows.methods - Module.methods).freeze
27
+
28
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
29
+ RSpec.configure do |config|
30
+ # rspec-expectations config goes here. You can use an alternate
31
+ # assertion/expectation library such as wrong or the stdlib/minitest
32
+ # assertions if you prefer.
33
+ config.expect_with :rspec do |expectations|
34
+ # This option will default to `true` in RSpec 4. It makes the `description`
35
+ # and `failure_message` of custom matchers include text for helper methods
36
+ # defined using `chain`, e.g.:
37
+ # be_bigger_than(2).and_smaller_than(4).description
38
+ # # => "be bigger than 2 and smaller than 4"
39
+ # ...rather than:
40
+ # # => "be bigger than 2"
41
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
42
+ end
43
+
44
+ # rspec-mocks config goes here. You can use an alternate test double
45
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
46
+ config.mock_with :rspec do |mocks|
47
+ # Prevents you from mocking or stubbing a method that does not exist on
48
+ # a real object. This is generally recommended, and will default to
49
+ # `true` in RSpec 4.
50
+ mocks.verify_partial_doubles = true
51
+ end
52
+
53
+ # These two settings work together to allow you to limit a spec run
54
+ # to individual examples or groups you care about by tagging them with
55
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
56
+ # get run.
57
+ config.filter_run :focus
58
+ config.run_all_when_everything_filtered = true
59
+
60
+ config.filter_run_excluding windows_only: true unless ChefUtils.windows?
61
+ config.filter_run_excluding unix_only: true if ChefUtils.windows?
62
+
63
+ # Limits the available syntax to the non-monkey patched syntax that is
64
+ # recommended. For more details, see:
65
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
66
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
67
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
68
+ config.disable_monkey_patching!
69
+
70
+ # This setting enables warnings. It's recommended, but in some cases may
71
+ # be too noisy due to issues in dependencies.
72
+ config.warnings = true
73
+
74
+ # Many RSpec users commonly either run the entire suite or an individual
75
+ # file, and it's useful to allow more verbose output when running an
76
+ # individual spec file.
77
+ if config.files_to_run.one?
78
+ # Use the documentation formatter for detailed output,
79
+ # unless a formatter has already been configured
80
+ # (e.g. via a command-line flag).
81
+ config.default_formatter = "doc"
82
+ end
83
+
84
+ # Print the 10 slowest examples and example groups at the
85
+ # end of the spec run, to help surface which specs are running
86
+ # particularly slow.
87
+ # config.profile_examples = 10
88
+
89
+ # Run specs in random order to surface order dependencies. If you find an
90
+ # order dependency and want to debug it, you can fix the order by providing
91
+ # the seed, which is printed after each run.
92
+ # --seed 1234
93
+ config.order = :random
94
+
95
+ # Seed global randomization in this process using the `--seed` CLI option.
96
+ # Setting this allows you to use `--seed` to deterministically reproduce
97
+ # test failures related to randomization by passing the same `--seed` value
98
+ # as the one that triggered the failure.
99
+ Kernel.srand config.seed
100
+ end
@@ -1,151 +1,151 @@
1
- # frozen_string_literal: true
2
- #
3
- # Copyright:: Copyright (c) Chef Software Inc.
4
- # License:: Apache License, Version 2.0
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
- require "spec_helper"
20
-
21
- def arch_reports_true_for(*args)
22
- args.each do |method|
23
- it "reports true for #{method}" do
24
- expect(described_class.send(method, node)).to be true
25
- end
26
- end
27
- (ARCH_HELPERS - args).each do |method|
28
- it "reports false for #{method}" do
29
- expect(described_class.send(method, node)).to be false
30
- end
31
- end
32
- end
33
-
34
- RSpec.describe ChefUtils::DSL::Architecture do
35
- let(:node) { { "kernel" => { "machine" => arch } } }
36
-
37
- ( HELPER_MODULES - [ described_class ] ).each do |klass|
38
- it "does not have methods that collide with #{klass}" do
39
- expect((klass.methods - Module.methods) & ARCH_HELPERS).to be_empty
40
- end
41
- end
42
-
43
- ARCH_HELPERS.each do |helper|
44
- it "has the #{helper} in the ChefUtils module" do
45
- expect(ChefUtils).to respond_to(helper)
46
- end
47
- end
48
-
49
- context "on x86_64" do
50
- let(:arch) { "x86_64" }
51
-
52
- arch_reports_true_for(:intel?, :_64_bit?)
53
- end
54
-
55
- context "on amd64" do
56
- let(:arch) { "amd64" }
57
-
58
- arch_reports_true_for(:intel?, :_64_bit?)
59
- end
60
- context "on ppc64" do
61
- let(:arch) { "ppc64" }
62
-
63
- arch_reports_true_for(:ppc64?, :_64_bit?)
64
- end
65
- context "on ppc64le" do
66
- let(:arch) { "ppc64le" }
67
-
68
- arch_reports_true_for(:ppc64le?, :_64_bit?)
69
- end
70
- context "on s390x" do
71
- let(:arch) { "s390x" }
72
-
73
- arch_reports_true_for(:s390x?, :_64_bit?)
74
- end
75
- context "on ia64" do
76
- let(:arch) { "ia64" }
77
-
78
- arch_reports_true_for(:_64_bit?)
79
- end
80
- context "on sparc64" do
81
- let(:arch) { "sparc64" }
82
-
83
- arch_reports_true_for(:_64_bit?)
84
- end
85
- context "on aarch64" do
86
- let(:arch) { "aarch64" }
87
-
88
- arch_reports_true_for(:_64_bit?, :arm?)
89
- end
90
- context "on arch64" do
91
- let(:arch) { "arch64" }
92
-
93
- arch_reports_true_for(:_64_bit?, :arm?)
94
- end
95
- context "on arm64" do
96
- let(:arch) { "arm64" }
97
-
98
- arch_reports_true_for(:_64_bit?, :arm?)
99
- end
100
- context "on sun4v" do
101
- let(:arch) { "sun4v" }
102
-
103
- arch_reports_true_for(:sparc?, :_64_bit?)
104
- end
105
- context "on sun4u" do
106
- let(:arch) { "sun4u" }
107
-
108
- arch_reports_true_for(:sparc?, :_64_bit?)
109
- end
110
- context "on i86pc" do
111
- let(:arch) { "i86pc" }
112
-
113
- arch_reports_true_for(:i386?, :intel?, :_32_bit?)
114
- end
115
- context "on i386" do
116
- let(:arch) { "i386" }
117
-
118
- arch_reports_true_for(:i386?, :intel?, :_32_bit?)
119
- end
120
- context "on i686" do
121
- let(:arch) { "i686" }
122
-
123
- arch_reports_true_for(:i386?, :intel?, :_32_bit?)
124
- end
125
- context "on powerpc" do
126
- let(:arch) { "powerpc" }
127
-
128
- arch_reports_true_for(:powerpc?, :_32_bit?)
129
- end
130
- context "on armhf" do
131
- let(:arch) { "armhf" }
132
-
133
- arch_reports_true_for(:armhf?, :_32_bit?, :arm?)
134
- end
135
- context "on armv6l" do
136
- let(:arch) { "armv6l" }
137
-
138
- arch_reports_true_for(:armhf?, :_32_bit?, :arm?)
139
- end
140
- context "on armv7l" do
141
- let(:arch) { "armv7l" }
142
-
143
- arch_reports_true_for(:armhf?, :_32_bit?, :arm?)
144
- end
145
-
146
- context "on s390" do
147
- let(:arch) { "s390" }
148
-
149
- arch_reports_true_for(:s390?, :_32_bit?)
150
- end
151
- end
1
+ # frozen_string_literal: true
2
+ #
3
+ # Copyright:: Copyright (c) Chef Software Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require "spec_helper"
20
+
21
+ def arch_reports_true_for(*args)
22
+ args.each do |method|
23
+ it "reports true for #{method}" do
24
+ expect(described_class.send(method, node)).to be true
25
+ end
26
+ end
27
+ (ARCH_HELPERS - args).each do |method|
28
+ it "reports false for #{method}" do
29
+ expect(described_class.send(method, node)).to be false
30
+ end
31
+ end
32
+ end
33
+
34
+ RSpec.describe ChefUtils::DSL::Architecture do
35
+ let(:node) { { "kernel" => { "machine" => arch } } }
36
+
37
+ ( HELPER_MODULES - [ described_class ] ).each do |klass|
38
+ it "does not have methods that collide with #{klass}" do
39
+ expect((klass.methods - Module.methods) & ARCH_HELPERS).to be_empty
40
+ end
41
+ end
42
+
43
+ ARCH_HELPERS.each do |helper|
44
+ it "has the #{helper} in the ChefUtils module" do
45
+ expect(ChefUtils).to respond_to(helper)
46
+ end
47
+ end
48
+
49
+ context "on x86_64" do
50
+ let(:arch) { "x86_64" }
51
+
52
+ arch_reports_true_for(:intel?, :_64_bit?)
53
+ end
54
+
55
+ context "on amd64" do
56
+ let(:arch) { "amd64" }
57
+
58
+ arch_reports_true_for(:intel?, :_64_bit?)
59
+ end
60
+ context "on ppc64" do
61
+ let(:arch) { "ppc64" }
62
+
63
+ arch_reports_true_for(:ppc64?, :_64_bit?)
64
+ end
65
+ context "on ppc64le" do
66
+ let(:arch) { "ppc64le" }
67
+
68
+ arch_reports_true_for(:ppc64le?, :_64_bit?)
69
+ end
70
+ context "on s390x" do
71
+ let(:arch) { "s390x" }
72
+
73
+ arch_reports_true_for(:s390x?, :_64_bit?)
74
+ end
75
+ context "on ia64" do
76
+ let(:arch) { "ia64" }
77
+
78
+ arch_reports_true_for(:_64_bit?)
79
+ end
80
+ context "on sparc64" do
81
+ let(:arch) { "sparc64" }
82
+
83
+ arch_reports_true_for(:_64_bit?)
84
+ end
85
+ context "on aarch64" do
86
+ let(:arch) { "aarch64" }
87
+
88
+ arch_reports_true_for(:_64_bit?, :arm?)
89
+ end
90
+ context "on arch64" do
91
+ let(:arch) { "arch64" }
92
+
93
+ arch_reports_true_for(:_64_bit?, :arm?)
94
+ end
95
+ context "on arm64" do
96
+ let(:arch) { "arm64" }
97
+
98
+ arch_reports_true_for(:_64_bit?, :arm?)
99
+ end
100
+ context "on sun4v" do
101
+ let(:arch) { "sun4v" }
102
+
103
+ arch_reports_true_for(:sparc?, :_64_bit?)
104
+ end
105
+ context "on sun4u" do
106
+ let(:arch) { "sun4u" }
107
+
108
+ arch_reports_true_for(:sparc?, :_64_bit?)
109
+ end
110
+ context "on i86pc" do
111
+ let(:arch) { "i86pc" }
112
+
113
+ arch_reports_true_for(:i386?, :intel?, :_32_bit?)
114
+ end
115
+ context "on i386" do
116
+ let(:arch) { "i386" }
117
+
118
+ arch_reports_true_for(:i386?, :intel?, :_32_bit?)
119
+ end
120
+ context "on i686" do
121
+ let(:arch) { "i686" }
122
+
123
+ arch_reports_true_for(:i386?, :intel?, :_32_bit?)
124
+ end
125
+ context "on powerpc" do
126
+ let(:arch) { "powerpc" }
127
+
128
+ arch_reports_true_for(:powerpc?, :_32_bit?)
129
+ end
130
+ context "on armhf" do
131
+ let(:arch) { "armhf" }
132
+
133
+ arch_reports_true_for(:armhf?, :_32_bit?, :arm?)
134
+ end
135
+ context "on armv6l" do
136
+ let(:arch) { "armv6l" }
137
+
138
+ arch_reports_true_for(:armhf?, :_32_bit?, :arm?)
139
+ end
140
+ context "on armv7l" do
141
+ let(:arch) { "armv7l" }
142
+
143
+ arch_reports_true_for(:armhf?, :_32_bit?, :arm?)
144
+ end
145
+
146
+ context "on s390" do
147
+ let(:arch) { "s390" }
148
+
149
+ arch_reports_true_for(:s390?, :_32_bit?)
150
+ end
151
+ end