chefspec 7.3.1 → 7.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e61ac80763278adaab322cc1801df9673c5ea2d49df59bc7c26977a9e3405923
4
- data.tar.gz: e64079926befe6e129ebfa265f9aa3c9c942f628ea8365cf5bd627ecb09c25ed
3
+ metadata.gz: 1c4571155e2841a391b08c56d4f7c6f9594a1101a0169d7f152f4d491b6657a4
4
+ data.tar.gz: 678d85972226787749577775b6f92b41863af50fa7e76d6a6b0e3771994d61d4
5
5
  SHA512:
6
- metadata.gz: 014e1bbaa47b6a88e6cb5f488d5ea25ff012694c0f7f97d18c12048d7377a9f204cb114ff9e68c7e4d4a575293bed12cc432ac623f516028db48c72cb090dfb8
7
- data.tar.gz: e7d54267e71d29d6fb57a1518d38ba4df4959fc6e49b967dc9860f2dbaedc39fcb12fb15704846b544daf3d017514a91ff7526849d1b13bc1869f4f193b84d06
6
+ metadata.gz: 8ef50f634ca41ff0c7eaf209cbfe6cc3ff890b2e072141aad3ad21862b5c6239fcf85adca96e5e5e95c18337673e4a4df5ab27d3729f7de4d7e615312d710717
7
+ data.tar.gz: c1c2c5e2f9bdfffdf6fdb2bc6c113a40a6274d626e4a34196738263cfcf4d73525d3818b271e5b8924e52411f8fd520c4a6c649e7c4f7fa8102c9f91f28a43af
@@ -1,5 +1,10 @@
1
1
  # CHANGELOG for ChefSpec
2
2
 
3
+ ## 7.3.2 (September 14, 2018)
4
+
5
+ - Improve runner construction code
6
+ - Make options to receive_shell_out work a bit better.
7
+
3
8
  ## 7.3.1 (September 1, 2018)
4
9
 
5
10
  - Add additional hooks for customizing the runner creation process.
@@ -25,7 +25,7 @@ Gem::Specification.new do |s|
25
25
 
26
26
  s.required_ruby_version = '>= 2.2'
27
27
 
28
- s.add_dependency 'chef', '>= 12.14.89'
28
+ s.add_dependency 'chef', '>= 12.16.42'
29
29
  s.add_dependency 'fauxhai', '>= 4'
30
30
  s.add_dependency 'rspec', '~> 3.0'
31
31
  end
@@ -5,6 +5,7 @@ property :value
5
5
  property :run_resource, [true, false], default: false
6
6
  property :run_load, [true, false], default: false
7
7
  property :run_provider, [true, false], default: false
8
+ property :user, default: nil
8
9
 
9
10
  def foo
10
11
  shell_out(cmd).stdout
@@ -16,5 +17,11 @@ end
16
17
 
17
18
  action :run do
18
19
  new_resource.foo if new_resource.run_resource
19
- shell_out!(new_resource.cmd) if new_resource.run_provider
20
+ if new_resource.run_provider
21
+ if new_resource.user
22
+ shell_out!(new_resource.cmd, user: new_resource.user)
23
+ else
24
+ shell_out!(new_resource.cmd)
25
+ end
26
+ end
20
27
  end
@@ -1,13 +1,14 @@
1
1
  describe 'stubs_for' do
2
2
  platform 'ubuntu'
3
3
  step_into :stubs_for_test, :stubs_for_old
4
- default_attributes['test'] = {run_load: false, run_resource: false, run_provider: false}
4
+ default_attributes['test'] = {run_load: false, run_resource: false, run_provider: false, user: nil}
5
5
  recipe do
6
6
  stubs_for_test 'test' do
7
7
  cmd 'this_is_not_a_cmd'
8
8
  run_load node['test']['run_load']
9
9
  run_resource node['test']['run_resource']
10
10
  run_provider node['test']['run_provider']
11
+ user node['test']['user']
11
12
  end
12
13
  end
13
14
 
@@ -113,6 +114,28 @@ describe 'stubs_for' do
113
114
  end
114
115
  subject
115
116
  end
117
+
118
+ context 'with a user' do
119
+ default_attributes['test']['user'] = 'foo'
120
+
121
+ it do
122
+ stubs_for_provider('stubs_for_test[test]') do |prov|
123
+ allow(prov).to receive_shell_out('this_is_not_a_cmd', stdout: 'asdf', user: 'foo')
124
+ end
125
+ subject
126
+ end
127
+ end
128
+
129
+ context 'with a user and a generic stub' do
130
+ default_attributes['test']['user'] = 'foo'
131
+
132
+ it do
133
+ stubs_for_provider('stubs_for_test[test]') do |prov|
134
+ allow(prov).to receive_shell_out('this_is_not_a_cmd', stdout: 'asdf')
135
+ end
136
+ subject
137
+ end
138
+ end
116
139
  end
117
140
 
118
141
  context 'with a single group-level resource stub' do
@@ -86,7 +86,7 @@ module ChefSpec
86
86
  def receive_shell_out(*cmd, stdout: '', stderr: '', exitstatus: 0, **opts)
87
87
  # Ruby does not allow constructing an actual exitstatus object from Ruby code. Really.
88
88
  fake_exitstatus = double(exitstatus: exitstatus)
89
- fake_cmd = Mixlib::ShellOut.new(*cmd, **opts)
89
+ fake_cmd = Mixlib::ShellOut.new(*cmd)
90
90
  fake_cmd.define_singleton_method(:run_command) { } # Do nothing, just in case.
91
91
  # Inject our canned data.
92
92
  fake_cmd.instance_exec do
@@ -100,7 +100,8 @@ module ChefSpec
100
100
  else
101
101
  :shell_out
102
102
  end
103
- receive(shell_out_method).with(*cmd).and_return(fake_cmd)
103
+ with_args = cmd + (opts.empty? ? [any_args] : [hash_including(opts)])
104
+ receive(shell_out_method).with(*with_args).and_return(fake_cmd)
104
105
  end
105
106
 
106
107
  module ClassMethods
@@ -1,3 +1,3 @@
1
1
  module ChefSpec
2
- VERSION = '7.3.1'
2
+ VERSION = '7.3.2'
3
3
  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: 7.3.1
4
+ version: 7.3.2
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: 2018-09-02 00:00:00.000000000 Z
12
+ date: 2018-09-15 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: 12.14.89
20
+ version: 12.16.42
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: 12.14.89
27
+ version: 12.16.42
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: fauxhai
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -797,7 +797,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
797
797
  version: '0'
798
798
  requirements: []
799
799
  rubyforge_project:
800
- rubygems_version: 2.7.7
800
+ rubygems_version: 2.7.6
801
801
  signing_key:
802
802
  specification_version: 4
803
803
  summary: Write RSpec examples and generate coverage reports for Chef recipes!