chefspec 4.6.1 → 4.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +16 -8
- data/CHANGELOG.md +6 -0
- data/README.md +38 -1
- data/chefspec.gemspec +1 -1
- data/lib/chefspec/server_runner.rb +1 -0
- data/lib/chefspec/solo_runner.rb +1 -0
- data/lib/chefspec/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d6b31aada6aae7b0e9d80006a7f59b4928b4e18
|
4
|
+
data.tar.gz: ef5e7a024c06199069f4349264a69a113f096571
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: caac16818a6152ae7cf12e4cc71a1649915be6d22fa175f486035009426e6c27d140e5a67833629976360765a99c4bbfbc1465c188ae7e8b4b66bf99066641d1
|
7
|
+
data.tar.gz: ad3ab1cf59daf6ea6f2aec22b7b417d96472d5625b927616d768e452aa30a12e8a05748e9871ea17b4544dba91c53290a4d0485dbbcf9af400035f06c54179b2
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -6,7 +6,6 @@ before_install:
|
|
6
6
|
- gem install bundler
|
7
7
|
|
8
8
|
rvm:
|
9
|
-
- 2.0.0
|
10
9
|
- 2.1
|
11
10
|
- 2.2
|
12
11
|
|
@@ -32,15 +31,24 @@ env:
|
|
32
31
|
- CHEF_VERSION=12.1.1
|
33
32
|
- CHEF_VERSION=12.1.0
|
34
33
|
- CHEF_VERSION=12.0.3
|
35
|
-
- CHEF_VERSION=11.18.6
|
36
|
-
- CHEF_VERSION=11.18.0
|
37
|
-
- CHEF_VERSION=11.16.4
|
38
|
-
- CHEF_VERSION=11.16.2
|
39
|
-
- CHEF_VERSION=11.16.0
|
40
|
-
- CHEF_VERSION=11.14.6
|
41
|
-
- CHEF_VERSION=11.14.2
|
42
34
|
|
43
35
|
matrix:
|
44
36
|
fast_finish: true
|
45
37
|
allow_failures:
|
46
38
|
- env: CHEF_VERSION=master
|
39
|
+
include:
|
40
|
+
- env: CHEF_VERSION=11.18.6
|
41
|
+
rvm: 1.9.3
|
42
|
+
- env: CHEF_VERSION=11.18.0
|
43
|
+
rvm: 1.9.3
|
44
|
+
- env: CHEF_VERSION=11.16.4
|
45
|
+
rvm: 1.9.3
|
46
|
+
- env: CHEF_VERSION=11.16.2
|
47
|
+
rvm: 1.9.3
|
48
|
+
- env: CHEF_VERSION=11.16.0
|
49
|
+
rvm: 1.9.3
|
50
|
+
- env: CHEF_VERSION=11.14.6
|
51
|
+
rvm: 1.9.3
|
52
|
+
- env: CHEF_VERSION=11.14.2
|
53
|
+
rvm: 1.9.3
|
54
|
+
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -462,7 +462,7 @@ Create an environment:
|
|
462
462
|
|
463
463
|
```ruby
|
464
464
|
ChefSpec::ServerRunner.new do |node, server|
|
465
|
-
server.create_environment('my_environment', { description: '...' })
|
465
|
+
server.create_environment('my_environment', { default_attributes: { description: '...' } })
|
466
466
|
end
|
467
467
|
```
|
468
468
|
|
@@ -571,6 +571,31 @@ describe 'example::default' do
|
|
571
571
|
end
|
572
572
|
```
|
573
573
|
|
574
|
+
### Library Helpers
|
575
|
+
|
576
|
+
Given a library helper with a `has_bacon?` method:
|
577
|
+
|
578
|
+
```ruby
|
579
|
+
module Demo
|
580
|
+
module Helper
|
581
|
+
|
582
|
+
include Chef::Mixin::ShellOut
|
583
|
+
|
584
|
+
def has_bacon?
|
585
|
+
cmd = shell_out!('getent passwd bacon', {:returns => [0,2]})
|
586
|
+
cmd.stderr.empty? && (cmd.stdout =~ /^bacon/)
|
587
|
+
end
|
588
|
+
end
|
589
|
+
end
|
590
|
+
```
|
591
|
+
|
592
|
+
Stub the output of the library helper. [Additional information](http://jtimberman.housepub.org/blog/2015/05/30/quick-tip-stubbing-library-helpers-in-chefspec/)
|
593
|
+
```ruby
|
594
|
+
before do
|
595
|
+
allow_any_instance_of(Chef::Node).to receive(:has_bacon?).and_return(true)
|
596
|
+
end
|
597
|
+
```
|
598
|
+
|
574
599
|
### Data Bag & Data Bag Item
|
575
600
|
**NOTE** This is not required if you are using a ChefSpec server.
|
576
601
|
|
@@ -759,6 +784,18 @@ end
|
|
759
784
|
|
760
785
|
Mocking Out Environments
|
761
786
|
------------------------
|
787
|
+
### ServerRunner
|
788
|
+
```ruby
|
789
|
+
ChefSpec::ServerRunner.new do |node, server|
|
790
|
+
# Create the environment
|
791
|
+
server.create_environment('staging', { default_attributes: { cookbook_attr: 'value' } })
|
792
|
+
|
793
|
+
# Assign the environment to the node
|
794
|
+
node.chef_environment = 'staging'
|
795
|
+
end
|
796
|
+
```
|
797
|
+
|
798
|
+
### SoloRunner
|
762
799
|
If you want to mock out `node.chef_environment`, you'll need to use RSpec mocks/stubs twice:
|
763
800
|
|
764
801
|
```ruby
|
data/chefspec.gemspec
CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |s|
|
|
31
31
|
s.add_dependency 'rspec', '~> 3.0'
|
32
32
|
|
33
33
|
# Development Dependencies
|
34
|
-
s.add_development_dependency 'rake', '<
|
34
|
+
s.add_development_dependency 'rake', '< 12.0'
|
35
35
|
s.add_development_dependency 'redcarpet', '~> 3.3'
|
36
36
|
s.add_development_dependency 'yard', '~> 0.8'
|
37
37
|
|
@@ -27,6 +27,7 @@ module ChefSpec
|
|
27
27
|
Chef::Config[:client_name] = 'chefspec'
|
28
28
|
Chef::Config[:node_name] = 'chefspec'
|
29
29
|
Chef::Config[:solo] = false
|
30
|
+
Chef::Config[:solo_legacy_mode] = false
|
30
31
|
|
31
32
|
Chef::Config[:chef_server_url] = server.url
|
32
33
|
Chef::Config[:http_retry_count] = 0
|
data/lib/chefspec/solo_runner.rb
CHANGED
@@ -79,6 +79,7 @@ module ChefSpec
|
|
79
79
|
Chef::Config[:role_path] = Array(@options[:role_path])
|
80
80
|
Chef::Config[:force_logger] = true
|
81
81
|
Chef::Config[:solo] = true
|
82
|
+
Chef::Config[:solo_legacy_mode] = true
|
82
83
|
Chef::Config[:environment_path] = @options[:environment_path]
|
83
84
|
|
84
85
|
yield node if block_given?
|
data/lib/chefspec/version.rb
CHANGED
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: 4.
|
4
|
+
version: 4.7.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: 2016-
|
12
|
+
date: 2016-05-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: chef
|
@@ -59,14 +59,14 @@ dependencies:
|
|
59
59
|
requirements:
|
60
60
|
- - "<"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: '
|
62
|
+
version: '12.0'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - "<"
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: '
|
69
|
+
version: '12.0'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: redcarpet
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|