chefspec 6.0.1 → 6.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +5 -5
- data/chefspec.gemspec +1 -1
- data/examples/batch/recipes/run.rb +0 -4
- data/examples/batch/spec/run_spec.rb +0 -4
- data/examples/bff_package/spec/install_spec.rb +1 -1
- data/examples/bff_package/spec/purge_spec.rb +1 -1
- data/examples/bff_package/spec/remove_spec.rb +1 -1
- data/examples/bff_package/spec/upgrade_spec.rb +1 -1
- data/examples/freebsd_package/spec/install_spec.rb +1 -1
- data/examples/freebsd_package/spec/remove_spec.rb +1 -1
- data/examples/homebrew_package/spec/install_spec.rb +1 -1
- data/examples/homebrew_package/spec/purge_spec.rb +1 -1
- data/examples/homebrew_package/spec/remove_spec.rb +1 -1
- data/examples/homebrew_package/spec/upgrade_spec.rb +1 -1
- data/examples/launchd/spec/create_if_missing_spec.rb +1 -1
- data/examples/launchd/spec/create_spec.rb +1 -1
- data/examples/launchd/spec/delete_spec.rb +1 -1
- data/examples/launchd/spec/disable_spec.rb +1 -1
- data/examples/launchd/spec/enable_spec.rb +1 -1
- data/examples/macports_package/spec/install_spec.rb +1 -1
- data/examples/macports_package/spec/purge_spec.rb +1 -1
- data/examples/macports_package/spec/remove_spec.rb +1 -1
- data/examples/macports_package/spec/upgrade_spec.rb +1 -1
- data/examples/openbsd_package/spec/install_spec.rb +1 -1
- data/examples/openbsd_package/spec/purge_spec.rb +1 -1
- data/examples/openbsd_package/spec/remove_spec.rb +1 -1
- data/examples/openbsd_package/spec/upgrade_spec.rb +1 -1
- data/examples/osx_profile/spec/install_spec.rb +1 -1
- data/examples/osx_profile/spec/remove_spec.rb +1 -1
- data/examples/pacman_package/spec/install_spec.rb +1 -1
- data/examples/pacman_package/spec/purge_spec.rb +1 -1
- data/examples/pacman_package/spec/remove_spec.rb +1 -1
- data/examples/pacman_package/spec/upgrade_spec.rb +1 -1
- data/examples/paludis_package/spec/install_spec.rb +1 -1
- data/examples/paludis_package/spec/purge_spec.rb +1 -1
- data/examples/paludis_package/spec/remove_spec.rb +1 -1
- data/examples/paludis_package/spec/upgrade_spec.rb +1 -1
- data/examples/powershell_script/recipes/run.rb +0 -4
- data/examples/powershell_script/spec/run_spec.rb +0 -4
- data/examples/roles/spec/default_spec.rb +1 -1
- data/examples/rpm_package/spec/install_spec.rb +1 -1
- data/examples/rpm_package/spec/remove_spec.rb +1 -1
- data/examples/rpm_package/spec/upgrade_spec.rb +1 -1
- data/examples/ruby_block/spec/create_spec.rb +1 -1
- data/examples/ruby_block/spec/run_spec.rb +1 -1
- data/examples/script/recipes/run_bash.rb +0 -4
- data/examples/script/recipes/run_csh.rb +0 -4
- data/examples/script/recipes/run_ksh.rb +0 -4
- data/examples/script/recipes/run_perl.rb +0 -4
- data/examples/script/recipes/run_python.rb +0 -4
- data/examples/script/recipes/run_ruby.rb +0 -4
- data/examples/script/recipes/run_script.rb +0 -4
- data/examples/script/spec/run_bash_spec.rb +0 -4
- data/examples/script/spec/run_csh_spec.rb +0 -4
- data/examples/script/spec/run_ksh_spec.rb +1 -5
- data/examples/script/spec/run_perl_spec.rb +0 -4
- data/examples/script/spec/run_python_spec.rb +0 -4
- data/examples/script/spec/run_ruby_spec.rb +0 -4
- data/examples/script/spec/run_script_spec.rb +0 -4
- data/examples/server/spec/data_bag_spec.rb +8 -8
- data/examples/server/spec/node_spec.rb +1 -1
- data/examples/solaris_package/spec/upgrade_spec.rb +4 -1
- data/examples/stub_data_bag/spec/default_spec.rb +1 -1
- data/examples/stub_data_bag_item/spec/default_spec.rb +1 -1
- data/examples/stub_search/spec/default_spec.rb +1 -1
- data/examples/yum_package/spec/install_spec.rb +1 -1
- data/examples/yum_package/spec/purge_spec.rb +1 -1
- data/examples/yum_package/spec/remove_spec.rb +1 -1
- data/examples/yum_package/spec/upgrade_spec.rb +1 -1
- data/examples/yum_repository/spec/add_spec.rb +1 -1
- data/examples/yum_repository/spec/create_spec.rb +1 -1
- data/examples/yum_repository/spec/delete_spec.rb +1 -1
- data/examples/yum_repository/spec/makecache_spec.rb +1 -1
- data/examples/yum_repository/spec/remove_spec.rb +1 -1
- data/examples/zypper_package/spec/install_spec.rb +1 -1
- data/examples/zypper_package/spec/purge_spec.rb +1 -1
- data/examples/zypper_package/spec/remove_spec.rb +1 -1
- data/examples/zypper_package/spec/upgrade_spec.rb +1 -1
- data/lib/chefspec/macros.rb +1 -1
- data/lib/chefspec/server_methods.rb +1 -1
- data/lib/chefspec/solo_runner.rb +2 -1
- data/lib/chefspec/version.rb +1 -1
- data/spec/unit/macros_spec.rb +2 -2
- data/spec/unit/solo_runner_spec.rb +3 -2
- metadata +10 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea0e7c6ed02f2b96fb4c08e4dd4e06af0c78ddc8
|
4
|
+
data.tar.gz: 153afc4930a9ce02084b4196caf01f73d8072a93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b672dcfb994f0e56022f024dac08344574ac51bb4b454ec34b373c95dd4e30248970bb8fc709e74c5a48534708303aebfc667f890dd7e1fd8d25ab328346959
|
7
|
+
data.tar.gz: '09db04b5da70480e38fc39886bc53782cca60a2fa24c604265e8d1dccb36b41a8eb4ac5271f0663502e3eb07810cc4fee1995e084edf9bf19f10a1a36328f4e7'
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# CHANGELOG for ChefSpec
|
2
2
|
|
3
|
+
## 6.1.0 (March 9, 2017)
|
4
|
+
|
5
|
+
- Loosen the Fauxhai dependency to allow Fauxhai 4.0 This deprecates a large number of Ohai mocks for end of life platforms. See <https://github.com/customink/fauxhai/blob/master/PLATFORMS.md> for the current list of platforms supported by Fauxhai
|
6
|
+
- SoloRunner defaults to use_policyfile == false now
|
7
|
+
|
3
8
|
## 6.0.1 (February 24, 2017)
|
4
9
|
|
5
10
|
- Add the ability to set the Chef Zero port range used by the ServerRunner
|
data/README.md
CHANGED
@@ -19,7 +19,7 @@ ChefSpec runs your cookbook(s) locally with Chef Solo without actually convergin
|
|
19
19
|
|
20
20
|
## Important Notes
|
21
21
|
|
22
|
-
- **ChefSpec requires Ruby 2.
|
22
|
+
- **ChefSpec requires Ruby 2.2 or later and Chef 12.6 or later!**
|
23
23
|
- **This documentation corresponds to the master branch, which may be unreleased. Please check the README of the latest git tag or the gem's source for your version's documentation!**
|
24
24
|
- **Each resource matcher is self-documented using [Yard](http://rubydoc.info/github/sethvargo/chefspec) and has a corresponding aruba test from the [examples directory](https://github.com/sethvargo/chefspec/tree/master/examples).**
|
25
25
|
- **ChefSpec aims to maintain compatibility with the two most recent minor versions of Chef.** If you are running an older version of Chef it may work, or you will need to run an older version of ChefSpec.
|
@@ -58,7 +58,7 @@ Let's step through this file to see what is happening:
|
|
58
58
|
|
59
59
|
1. At the top of the spec file we require the chefspec gem. This is required so that our custom matchers are loaded. In larger projects, it is common practice to create a file named "spec_helper.rb" and include ChefSpec and perform other setup tasks in that file.
|
60
60
|
2. The `describe` keyword is part of RSpec and indicates that everything nested beneath is describing the `example::default` recipe. The convention is to have a separate spec for each recipe in your cookbook.
|
61
|
-
3. The `let` block on creates the `ChefSpec:
|
61
|
+
3. The `let` block on creates the `ChefSpec:SoloRunner` with mocked Ohai data for Ubuntu 16.04 from [Fauxhai](https://github.com/customink/fauxhai). It then does a fake Chef run with the run_list of `example::default`. Any subsequent examples can then refer to `chef_run` in order to make assertions about the resources that were created during the mock converge.
|
62
62
|
4. The `described_recipe` macro is a ChefSpec helper method that infers the recipe from the `describe` block. Alternatively you could specify the recipe directly.
|
63
63
|
5. The `it` block is an example specifying that the `foo` package is installed. Normally you will have multiple `it` blocks per recipe, each making a single assertion.
|
64
64
|
|
@@ -102,7 +102,7 @@ Values specified at the initialization of a "Runner" merge and take precedence o
|
|
102
102
|
ChefSpec::SoloRunner.new(version: '16.04')
|
103
103
|
|
104
104
|
# Use a different operating system platform and version
|
105
|
-
ChefSpec::SoloRunner.new(platform: 'centos', version: '7.
|
105
|
+
ChefSpec::SoloRunner.new(platform: 'centos', version: '7.3.1611')
|
106
106
|
|
107
107
|
# Specify a different cookbook_path
|
108
108
|
ChefSpec::SoloRunner.new(cookbook_path: '/var/my/other/path', role_path: '/var/my/roles')
|
@@ -117,7 +117,7 @@ ChefSpec::SoloRunner.new(file_cache_path: Chef::Config[:file_cache_path])
|
|
117
117
|
ChefSpec::SoloRunner.new(log_level: :debug).converge(described_recipe)
|
118
118
|
```
|
119
119
|
|
120
|
-
**NOTE** You do not _need_ to specify a platform and version to use ChefSpec. However, some cookbooks may rely on [Ohai](http://github.com/chef/ohai) data that ChefSpec cannot not automatically generate. Specifying the `platform` and `version` keys instructs ChefSpec to load stubbed Ohai attributes from another platform using [fauxhai](https://github.com/customink/fauxhai).
|
120
|
+
**NOTE** You do not _need_ to specify a platform and version to use ChefSpec. However, some cookbooks may rely on [Ohai](http://github.com/chef/ohai) data that ChefSpec cannot not automatically generate. Specifying the `platform` and `version` keys instructs ChefSpec to load stubbed Ohai attributes from another platform using [fauxhai](https://github.com/customink/fauxhai). See the [PLATFORMS.md file](https://github.com/customink/fauxhai/blob/master/PLATFORMS.md) in the Fauxhai repo for a complete list of platforms and versions for use with ChefSpec.
|
121
121
|
|
122
122
|
### ChefZero Server
|
123
123
|
|
@@ -503,7 +503,7 @@ end
|
|
503
503
|
You may also use the `stub_node` macro, which will create a new `Chef::Node` object and accepts the same parameters as the Chef Runner and a Fauxhai object:
|
504
504
|
|
505
505
|
```ruby
|
506
|
-
www = stub_node(platform: 'ubuntu', version: '
|
506
|
+
www = stub_node(platform: 'ubuntu', version: '16.04') do |node|
|
507
507
|
node.normal['attribute'] = 'value'
|
508
508
|
end
|
509
509
|
|
data/chefspec.gemspec
CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
|
|
26
26
|
s.required_ruby_version = '>= 2.2'
|
27
27
|
|
28
28
|
s.add_dependency 'chef', '>= 12.0'
|
29
|
-
s.add_dependency 'fauxhai', '
|
29
|
+
s.add_dependency 'fauxhai', '>= 3.6', '< 5'
|
30
30
|
s.add_dependency 'rspec', '~> 3.0'
|
31
31
|
|
32
32
|
# Development Dependencies
|
@@ -19,8 +19,4 @@ describe 'batch::run' do
|
|
19
19
|
expect(chef_run).to run_batch('with_attributes').with(flags: '-f')
|
20
20
|
expect(chef_run).to_not run_batch('with_attributes').with(flags: '-x')
|
21
21
|
end
|
22
|
-
|
23
|
-
it 'runs a batch when specifying the identity attribute' do
|
24
|
-
expect(chef_run).to run_batch('identity_attribute')
|
25
|
-
end
|
26
22
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'bff_package::install' do
|
4
|
-
let(:chef_run) { ChefSpec::SoloRunner.converge(described_recipe) }
|
4
|
+
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'aix', version: '7.1').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'installs a bff_package with the default action' do
|
7
7
|
expect(chef_run).to install_bff_package('default_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'bff_package::purge' do
|
4
|
-
let(:chef_run) { ChefSpec::SoloRunner.converge(described_recipe) }
|
4
|
+
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'aix', version: '7.1').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'purges a bff_package with an explicit action' do
|
7
7
|
expect(chef_run).to purge_bff_package('explicit_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'bff_package::remove' do
|
4
|
-
let(:chef_run) { ChefSpec::SoloRunner.converge(described_recipe) }
|
4
|
+
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'aix', version: '7.1').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'removes a bff_package with an explicit action' do
|
7
7
|
expect(chef_run).to remove_bff_package('explicit_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'bff_package::upgrade' do
|
4
|
-
let(:chef_run) { ChefSpec::SoloRunner.converge(described_recipe) }
|
4
|
+
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'aix', version: '7.1').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'upgrades a bff_package with an explicit action' do
|
7
7
|
expect(chef_run).to upgrade_bff_package('explicit_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'homebrew_package::install' do
|
4
|
-
let(:chef_run) { ChefSpec::
|
4
|
+
let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'mac_os_x', version: '10.12').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'installs a homebrew_package with the default action' do
|
7
7
|
expect(chef_run).to install_homebrew_package('default_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'homebrew_package::purge' do
|
4
|
-
let(:chef_run) { ChefSpec::
|
4
|
+
let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'mac_os_x', version: '10.12').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'purges a homebrew_package with an explicit action' do
|
7
7
|
expect(chef_run).to purge_homebrew_package('explicit_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'homebrew_package::remove' do
|
4
|
-
let(:chef_run) { ChefSpec::
|
4
|
+
let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'mac_os_x', version: '10.12').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'removes a homebrew_package with an explicit action' do
|
7
7
|
expect(chef_run).to remove_homebrew_package('explicit_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'homebrew_package::upgrade' do
|
4
|
-
let(:chef_run) { ChefSpec::
|
4
|
+
let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'mac_os_x', version: '10.12').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'upgrades a homebrew_package with an explicit action' do
|
7
7
|
expect(chef_run).to upgrade_homebrew_package('explicit_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'launchd::create_if_missing' do
|
4
|
-
let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'mac_os_x', version: '10.
|
4
|
+
let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'mac_os_x', version: '10.12').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'creates a launchd daemon if missing with an explicit action' do
|
7
7
|
expect(chef_run).to create_if_missing_launchd('explicit_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'launchd::create' do
|
4
|
-
let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'mac_os_x', version: '10.
|
4
|
+
let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'mac_os_x', version: '10.12').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'creates a launchd daemon with an explicit action' do
|
7
7
|
expect(chef_run).to create_launchd('explicit_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'launchd::delete' do
|
4
|
-
let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'mac_os_x', version: '10.
|
4
|
+
let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'mac_os_x', version: '10.12').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'deletes a launchd with an explicit action' do
|
7
7
|
expect(chef_run).to delete_launchd('explicit_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'launchd::disable' do
|
4
|
-
let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'mac_os_x', version: '10.
|
4
|
+
let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'mac_os_x', version: '10.12').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'disables a launchd daemon with an explicit action' do
|
7
7
|
expect(chef_run).to disable_launchd('explicit_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'launchd::enable' do
|
4
|
-
let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'mac_os_x', version: '10.
|
4
|
+
let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'mac_os_x', version: '10.12').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'enables a launchd daemon with an explicit action' do
|
7
7
|
expect(chef_run).to enable_launchd('explicit_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'macports_package::install' do
|
4
|
-
let(:chef_run) { ChefSpec::ServerRunner.new(platform: '
|
4
|
+
let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'mac_os_x', version: '10.12').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'installs a macports_package with the default action' do
|
7
7
|
expect(chef_run).to install_macports_package('default_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'macports_package::purge' do
|
4
|
-
let(:chef_run) { ChefSpec::ServerRunner.new(platform: '
|
4
|
+
let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'mac_os_x', version: '10.12').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'purges a macports_package with an explicit action' do
|
7
7
|
expect(chef_run).to purge_macports_package('explicit_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'macports_package::remove' do
|
4
|
-
let(:chef_run) { ChefSpec::ServerRunner.new(platform: '
|
4
|
+
let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'mac_os_x', version: '10.12').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'removes a macports_package with an explicit action' do
|
7
7
|
expect(chef_run).to remove_macports_package('explicit_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'macports_package::upgrade' do
|
4
|
-
let(:chef_run) { ChefSpec::ServerRunner.new(platform: '
|
4
|
+
let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'mac_os_x', version: '10.12').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'upgrades a macports_package with an explicit action' do
|
7
7
|
expect(chef_run).to upgrade_macports_package('explicit_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'openbsd_package::install' do
|
4
|
-
let(:chef_run) { ChefSpec::SoloRunner.converge(described_recipe) }
|
4
|
+
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'openbsd', version: '5.4').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'installs a openbsd_package with the default action' do
|
7
7
|
expect(chef_run).to install_openbsd_package('default_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'openbsd_package::purge' do
|
4
|
-
let(:chef_run) { ChefSpec::SoloRunner.converge(described_recipe) }
|
4
|
+
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'openbsd', version: '5.4').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'purges a openbsd_package with an explicit action' do
|
7
7
|
expect(chef_run).to purge_openbsd_package('explicit_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'openbsd_package::remove' do
|
4
|
-
let(:chef_run) { ChefSpec::SoloRunner.converge(described_recipe) }
|
4
|
+
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'openbsd', version: '5.4').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'removes a openbsd_package with an explicit action' do
|
7
7
|
expect(chef_run).to remove_openbsd_package('explicit_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'openbsd_package::upgrade' do
|
4
|
-
let(:chef_run) { ChefSpec::SoloRunner.converge(described_recipe) }
|
4
|
+
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'openbsd', version: '5.4').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'upgrades a openbsd_package with an explicit action' do
|
7
7
|
expect(chef_run).to upgrade_openbsd_package('explicit_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'osx_profile::install' do
|
4
|
-
let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'mac_os_x', version: '10.
|
4
|
+
let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'mac_os_x', version: '10.12').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'installs an osx_profile with an explicit action' do
|
7
7
|
expect(chef_run).to install_osx_profile('explicit_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'osx_profile::remove' do
|
4
|
-
let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'mac_os_x', version: '10.
|
4
|
+
let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'mac_os_x', version: '10.12').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'removes an osx_profile from the resource name' do
|
7
7
|
expect(chef_run).to remove_osx_profile('specifying profile')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'paludis_package::install' do
|
4
|
-
let(:chef_run) { ChefSpec::SoloRunner.new(platform: '
|
4
|
+
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'gentoo', version: '2.2').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'installs a paludis_package with the default action' do
|
7
7
|
expect(chef_run).to install_paludis_package('default_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'paludis_package::purge' do
|
4
|
-
let(:chef_run) { ChefSpec::SoloRunner.new(platform: '
|
4
|
+
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'gentoo', version: '2.2').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'purges a paludis_package with an explicit action' do
|
7
7
|
expect(chef_run).to purge_paludis_package('explicit_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'paludis_package::remove' do
|
4
|
-
let(:chef_run) { ChefSpec::SoloRunner.new(platform: '
|
4
|
+
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'gentoo', version: '2.2').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'removes a paludis_package with an explicit action' do
|
7
7
|
expect(chef_run).to remove_paludis_package('explicit_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'paludis_package::upgrade' do
|
4
|
-
let(:chef_run) { ChefSpec::SoloRunner.new(platform: '
|
4
|
+
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'gentoo', version: '2.2').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'upgrades a paludis_package with an explicit action' do
|
7
7
|
expect(chef_run).to upgrade_paludis_package('explicit_action')
|
@@ -19,8 +19,4 @@ describe 'powershell_script::run' do
|
|
19
19
|
expect(chef_run).to run_powershell_script('with_attributes').with(flags: '--flags')
|
20
20
|
expect(chef_run).to_not run_powershell_script('with_attributes').with(flags: '--not-flags')
|
21
21
|
end
|
22
|
-
|
23
|
-
it 'runs a powershell_script when specifying the identity attribute' do
|
24
|
-
expect(chef_run).to run_powershell_script('identity_attribute')
|
25
|
-
end
|
26
22
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'roles' do
|
4
|
-
let(:chef_run) { ChefSpec::SoloRunner.converge('role[role]') }
|
4
|
+
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04').converge('role[role]') }
|
5
5
|
|
6
6
|
it 'expands the run_list' do
|
7
7
|
expect(chef_run).to include_recipe('roles::default')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'ruby_block::create' do
|
4
|
-
let(:chef_run) { ChefSpec::SoloRunner.converge(described_recipe) }
|
4
|
+
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'creates a ruby_block with an explicit action' do
|
7
7
|
expect(chef_run).to create_ruby_block('explicit_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'ruby_block::run' do
|
4
|
-
let(:chef_run) { ChefSpec::
|
4
|
+
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'runs a ruby_block with the default action' do
|
7
7
|
expect(chef_run).to run_ruby_block('default_action')
|
@@ -16,8 +16,4 @@ describe 'script::run_bash' do
|
|
16
16
|
expect(chef_run).to run_bash('with_attributes').with(creates: 'creates')
|
17
17
|
expect(chef_run).to_not run_bash('with_attributes').with(creates: 'bacon')
|
18
18
|
end
|
19
|
-
|
20
|
-
it 'runs a bash script when specifying the identity attribute' do
|
21
|
-
expect(chef_run).to run_bash('identity_attribute')
|
22
|
-
end
|
23
19
|
end
|
@@ -16,8 +16,4 @@ describe 'script::run_csh' do
|
|
16
16
|
expect(chef_run).to run_csh('with_attributes').with(creates: 'creates')
|
17
17
|
expect(chef_run).to_not run_csh('with_attributes').with(creates: 'bacon')
|
18
18
|
end
|
19
|
-
|
20
|
-
it 'runs a csh script when specifying the identity attribute' do
|
21
|
-
expect(chef_run).to run_csh('identity_attribute')
|
22
|
-
end
|
23
19
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'script::run_ksh' do
|
4
|
-
let(:chef_run) { ChefSpec::SoloRunner.converge(described_recipe) }
|
4
|
+
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'runs a ksh script with the default action' do
|
7
7
|
expect(chef_run).to run_ksh('default_action')
|
@@ -16,8 +16,4 @@ describe 'script::run_ksh' do
|
|
16
16
|
expect(chef_run).to run_ksh('with_attributes').with(creates: 'creates')
|
17
17
|
expect(chef_run).to_not run_ksh('with_attributes').with(creates: 'bacon')
|
18
18
|
end
|
19
|
-
|
20
|
-
it 'runs a ksh script when specifying the identity attribute' do
|
21
|
-
expect(chef_run).to run_ksh('identity_attribute')
|
22
|
-
end
|
23
19
|
end
|
@@ -16,8 +16,4 @@ describe 'script::run_perl' do
|
|
16
16
|
expect(chef_run).to run_perl('with_attributes').with(creates: 'creates')
|
17
17
|
expect(chef_run).to_not run_perl('with_attributes').with(creates: 'bacon')
|
18
18
|
end
|
19
|
-
|
20
|
-
it 'runs a perl script when specifying the identity attribute' do
|
21
|
-
expect(chef_run).to run_perl('identity_attribute')
|
22
|
-
end
|
23
19
|
end
|
@@ -16,8 +16,4 @@ describe 'script::run_python' do
|
|
16
16
|
expect(chef_run).to run_python('with_attributes').with(creates: 'creates')
|
17
17
|
expect(chef_run).to_not run_python('with_attributes').with(creates: 'bacon')
|
18
18
|
end
|
19
|
-
|
20
|
-
it 'runs a python script when specifying the identity attribute' do
|
21
|
-
expect(chef_run).to run_python('identity_attribute')
|
22
|
-
end
|
23
19
|
end
|
@@ -16,8 +16,4 @@ describe 'script::run_ruby' do
|
|
16
16
|
expect(chef_run).to run_ruby('with_attributes').with(creates: 'creates')
|
17
17
|
expect(chef_run).to_not run_ruby('with_attributes').with(creates: 'bacon')
|
18
18
|
end
|
19
|
-
|
20
|
-
it 'runs a ruby script when specifying the identity attribute' do
|
21
|
-
expect(chef_run).to run_ruby('identity_attribute')
|
22
|
-
end
|
23
19
|
end
|
@@ -16,8 +16,4 @@ describe 'script::run_script' do
|
|
16
16
|
expect(chef_run).to run_script('with_attributes').with(creates: 'creates')
|
17
17
|
expect(chef_run).to_not run_script('with_attributes').with(creates: 'bacon')
|
18
18
|
end
|
19
|
-
|
20
|
-
it 'runs a script when specifying the identity attribute' do
|
21
|
-
expect(chef_run).to run_script('identity_attribute')
|
22
|
-
end
|
23
19
|
end
|
@@ -3,14 +3,14 @@ require 'chefspec'
|
|
3
3
|
describe 'server::data_bag' do
|
4
4
|
let(:chef_run) do
|
5
5
|
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04') do |_node, server|
|
6
|
-
server.create_data_bag('accounts',
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
6
|
+
server.create_data_bag('accounts', 'github' => {
|
7
|
+
'username' => 'sethvargo',
|
8
|
+
'password' => 'p@ssW0rd!',
|
9
|
+
},
|
10
|
+
'twitter' => {
|
11
|
+
'username' => 'sethvargo',
|
12
|
+
'password' => '0th3r',
|
13
|
+
})
|
14
14
|
end.converge(described_recipe)
|
15
15
|
end
|
16
16
|
|
@@ -27,7 +27,7 @@ describe 'server::node' do
|
|
27
27
|
|
28
28
|
node = chef_run.get_node('chefspec')
|
29
29
|
expect(node['kernel']['name']).to eq('Linux')
|
30
|
-
expect(node['kernel']['release']).to
|
30
|
+
expect(node['kernel']['release']).to match(/4.4.0-.*-generic/) # avoid failing when fauxhai data changes
|
31
31
|
expect(node['kernel']['machine']).to eq('x86_64')
|
32
32
|
end
|
33
33
|
end
|
@@ -1,7 +1,10 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'solaris_package::upgrade' do
|
4
|
-
let(:chef_run)
|
4
|
+
let(:chef_run) do
|
5
|
+
ChefSpec::ServerRunner.new(platform: 'solaris2', version: '5.11')
|
6
|
+
.converge(described_recipe)
|
7
|
+
end
|
5
8
|
|
6
9
|
it 'upgrades a solaris_package with an explicit action' do
|
7
10
|
expect(chef_run).to upgrade_solaris_package('explicit_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'stub_data_bag::default' do
|
4
|
-
let(:chef_run) { ChefSpec::SoloRunner.converge(described_recipe) }
|
4
|
+
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
|
5
5
|
|
6
6
|
context 'when the data_bag is not stubbed' do
|
7
7
|
it 'raises an exception' do
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'stub_data_bag_item::default' do
|
4
|
-
let(:chef_run) { ChefSpec::SoloRunner.converge(described_recipe) }
|
4
|
+
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
|
5
5
|
|
6
6
|
context 'when the data_bag_item is not stubbed' do
|
7
7
|
it 'raises an exception' do
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'stub_search::default' do
|
4
|
-
let(:chef_run) { ChefSpec::SoloRunner.converge(described_recipe) }
|
4
|
+
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
|
5
5
|
|
6
6
|
context 'when the search is not stubbed' do
|
7
7
|
it 'raises an exception' do
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'zypper_package::install' do
|
4
|
-
let(:chef_run) { ChefSpec::SoloRunner.converge(described_recipe) }
|
4
|
+
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'opensuse', version: '42.1').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'installs a zypper_package with the default action' do
|
7
7
|
expect(chef_run).to install_zypper_package('default_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'zypper_package::purge' do
|
4
|
-
let(:chef_run) { ChefSpec::SoloRunner.converge(described_recipe) }
|
4
|
+
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'opensuse', version: '42.1').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'purges a zypper_package with an explicit action' do
|
7
7
|
expect(chef_run).to purge_zypper_package('explicit_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'zypper_package::remove' do
|
4
|
-
let(:chef_run) { ChefSpec::SoloRunner.converge(described_recipe) }
|
4
|
+
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'opensuse', version: '42.1').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'removes a zypper_package with an explicit action' do
|
7
7
|
expect(chef_run).to remove_zypper_package('explicit_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'zypper_package::upgrade' do
|
4
|
-
let(:chef_run) { ChefSpec::SoloRunner.converge(described_recipe) }
|
4
|
+
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'opensuse', version: '42.1').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'upgrades a zypper_package with an explicit action' do
|
7
7
|
expect(chef_run).to upgrade_zypper_package('explicit_action')
|
data/lib/chefspec/macros.rb
CHANGED
@@ -139,7 +139,7 @@ module ChefSpec
|
|
139
139
|
# stub_node('mynode.example')
|
140
140
|
#
|
141
141
|
# @example mocking a specific platform and version
|
142
|
-
# stub_node('mynode.example', platform: 'ubuntu', version: '
|
142
|
+
# stub_node('mynode.example', platform: 'ubuntu', version: '16.04')
|
143
143
|
#
|
144
144
|
# @example overriding a specific ohai attribute
|
145
145
|
# stub_node('mynode.example', ohai: { ipaddress: '1.2.3.4' })
|
@@ -115,7 +115,7 @@ module ChefSpec
|
|
115
115
|
#
|
116
116
|
# @example Create a node from a +Chef::Node+ object
|
117
117
|
#
|
118
|
-
# node = stub_node('bacon', platform: 'ubuntu', version: '
|
118
|
+
# node = stub_node('bacon', platform: 'ubuntu', version: '16.04')
|
119
119
|
# create_node(node)
|
120
120
|
#
|
121
121
|
# @param [String, Chef::Node] object
|
data/lib/chefspec/solo_runner.rb
CHANGED
@@ -34,7 +34,7 @@ module ChefSpec
|
|
34
34
|
# ChefSpec::SoloRunner.new
|
35
35
|
#
|
36
36
|
# @example Specifying the platform and version
|
37
|
-
# ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '
|
37
|
+
# ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04')
|
38
38
|
#
|
39
39
|
# @example Specifying the cookbook path
|
40
40
|
# ChefSpec::SoloRunner.new(cookbook_path: ['/cookbooks'])
|
@@ -80,6 +80,7 @@ module ChefSpec
|
|
80
80
|
Chef::Config[:force_logger] = true
|
81
81
|
Chef::Config[:solo] = true
|
82
82
|
Chef::Config[:solo_legacy_mode] = true
|
83
|
+
Chef::Config[:use_policyfile] = false
|
83
84
|
Chef::Config[:environment_path] = @options[:environment_path]
|
84
85
|
|
85
86
|
yield node if block_given?
|
data/lib/chefspec/version.rb
CHANGED
data/spec/unit/macros_spec.rb
CHANGED
@@ -71,8 +71,8 @@ describe ChefSpec::Macros do
|
|
71
71
|
end
|
72
72
|
|
73
73
|
it 'sets the automatic attributes for a specific platform and version' do
|
74
|
-
node = described_class.stub_node('node.example', platform: 'ubuntu', version: '
|
75
|
-
expect(node.automatic).to eq(Fauxhai.mock(platform: 'ubuntu', version: '
|
74
|
+
node = described_class.stub_node('node.example', platform: 'ubuntu', version: '16.04')
|
75
|
+
expect(node.automatic).to eq(Fauxhai.mock(platform: 'ubuntu', version: '16.04').data)
|
76
76
|
end
|
77
77
|
|
78
78
|
it 'sets the automatic attributes from a JSON data path' do
|
@@ -70,6 +70,7 @@ describe ChefSpec::SoloRunner do
|
|
70
70
|
expect(Chef::Config.force_logger).to be_truthy
|
71
71
|
expect(Chef::Config.no_lazy_load).to be_truthy
|
72
72
|
expect(Chef::Config.solo).to be_truthy
|
73
|
+
expect(Chef::Config.use_policyfile).to be_falsey
|
73
74
|
end
|
74
75
|
|
75
76
|
it 'yields a block to set node attributes' do
|
@@ -92,12 +93,12 @@ describe ChefSpec::SoloRunner do
|
|
92
93
|
end
|
93
94
|
|
94
95
|
context 'fauxhai attributes' do
|
95
|
-
let(:hash) { described_class.new(platform: 'ubuntu', version: '
|
96
|
+
let(:hash) { described_class.new(platform: 'ubuntu', version: '16.04').node.to_hash }
|
96
97
|
|
97
98
|
it 'sets the attributes from fauxhai' do
|
98
99
|
expect(hash['os']).to eq('linux')
|
99
100
|
expect(hash['languages']['ruby']['ruby_bin']).to eq('/usr/local/bin/ruby')
|
100
|
-
expect(hash['os_version']).to
|
101
|
+
expect(hash['os_version']).to match(/4.4.0-.*-generic/) # avoid failing when fauxhai data changes
|
101
102
|
expect(hash['fqdn']).to eq('fauxhai.local')
|
102
103
|
expect(hash['domain']).to eq('local')
|
103
104
|
expect(hash['ipaddress']).to eq('10.0.0.2')
|
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: 6.0
|
4
|
+
version: 6.1.0
|
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: 2017-
|
12
|
+
date: 2017-03-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: chef
|
@@ -29,16 +29,22 @@ dependencies:
|
|
29
29
|
name: fauxhai
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- - "
|
32
|
+
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '3.6'
|
35
|
+
- - "<"
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '5'
|
35
38
|
type: :runtime
|
36
39
|
prerelease: false
|
37
40
|
version_requirements: !ruby/object:Gem::Requirement
|
38
41
|
requirements:
|
39
|
-
- - "
|
42
|
+
- - ">="
|
40
43
|
- !ruby/object:Gem::Version
|
41
44
|
version: '3.6'
|
45
|
+
- - "<"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5'
|
42
48
|
- !ruby/object:Gem::Dependency
|
43
49
|
name: rspec
|
44
50
|
requirement: !ruby/object:Gem::Requirement
|