Skip to content

Commit 6988a76

Browse files
authored
Merge pull request #44 from tas50/master
Fix failing Chefspecs
2 parents 9c61942 + d5d054f commit 6988a76

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

.travis.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,15 @@ env:
2929
before_script:
3030
- sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER )
3131
- eval "$(/opt/chefdk/bin/chef shell-init bash)"
32+
- /opt/chefdk/embedded/bin/chef --version
33+
- /opt/chefdk/embedded/bin/cookstyle --version
34+
- /opt/chefdk/embedded/bin/foodcritic --version
3235
- /opt/chefdk/embedded/bin/chef gem install coveralls # needed for chefspecs
3336

3437
script: KITCHEN_LOCAL_YAML=.kitchen.docker.yml /opt/chefdk/embedded/bin/kitchen verify ${INSTANCE}
3538

3639
matrix:
3740
include:
38-
- before_script:
39-
- eval "$(/opt/chefdk/bin/chef shell-init bash)"
40-
- /opt/chefdk/embedded/bin/chef --version
41-
- /opt/chefdk/embedded/bin/cookstyle --version
42-
- /opt/chefdk/embedded/bin/foodcritic --version
4341
- script:
4442
- /opt/chefdk/bin/chef exec rake
4543
env: UNIT_AND_LINT=1

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)