Skip to content

Commit d5d054f

Browse files
committed
Fix failing chefspec
Also remove a bunch of stubbed commands that weren’t necessary Signed-off-by: Tim Smith <tsmith@chef.io>
1 parent ee670a2 commit d5d054f

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

spec/recipes/default_spec.rb

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,17 @@
1515
# limitations under the License.
1616
#
1717

18-
require_relative '../spec_helper'
18+
require 'spec_helper'
1919

2020
describe 'nginx-hardening::default' do
21-
before { allow_any_instance_of(Chef::Recipe).to receive(:search) }
2221
let(:runner) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04') }
23-
let(:node) { runner.node }
2422
let(:chef_run) { runner.converge('chef_nginx::default', described_recipe) }
2523

26-
before do
27-
stub_command('/usr/sbin/apache2 -t')
24+
before(:each) do
2825
stub_command("find /etc/nginx -perm -o+r -type f -o -perm -o+w -type f | wc -l | egrep '^0$'")
29-
stub_command('which nginx').and_return(true)
30-
allow(::File).to receive(:exist?).and_return(false)
31-
allow(::File).to receive(:exist?).with('/etc/nginx/dh2048.pem').and_return(false)
3226
end
3327

34-
# check that the recipres are executed
28+
# check that the recipes are executed
3529
it 'default should include os-hardening recipes by default' do
3630
expect(chef_run).to include_recipe 'nginx-hardening::minimize_access'
3731
end

spec/spec_helper.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@
2020
require 'chefspec/berkshelf'
2121
require 'coveralls'
2222

23+
RSpec.configure do |config|
24+
config.color = true # Use color in STDOUT
25+
config.formatter = :documentation # Use the specified formatter
26+
config.log_level = :error # Avoid deprecation notice SPAM
27+
end
28+
2329
# coverage report
2430
Coveralls.wear!
2531
at_exit { ChefSpec::Coverage.report! }

0 commit comments

Comments
 (0)