Revert setting RSpec expectation syntax to 'should' mode (#3620)

* Revert "Silence RSpec 'should' Warning (#3560)"

This reverts commit 7c611a4c24.

* Add comment with link to reverted fix

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
This commit is contained in:
Clinton Wolfe 2018-11-16 17:04:04 -05:00 committed by Jared Quick
parent 35ad5d5528
commit e4afadfc3f
5 changed files with 15 additions and 35 deletions

View file

@ -1,14 +1,6 @@
require 'inspec/attribute_registry'
require 'rspec/core'
require 'rspec/core/example_group'
# Setup RSpec to allow use of `should` syntax without warnings
RSpec.configure do |config|
config.expect_with(:rspec) do |rspec_expectations_config|
rspec_expectations_config.syntax = :should
end
end
# This file allows you to add ExampleGroups to be used in rspec tests
#
class RSpec::Core::ExampleGroup

View file

@ -18,7 +18,9 @@ describe '2943 inspec exec for filter table profile, method mode for `where' do
cmd += ' --controls ' + controls.join(' ')
cmd = inspec(cmd)
data = JSON.parse(cmd.stdout)
# RSpec keeps issuing a deprecation count to stdout; I can't seem to disable it.
output = cmd.stdout.split("\n").reject {|line| line =~ /deprecation/}.join("\n")
data = JSON.parse(output)
failed_controls = data['profiles'][0]['controls'].select { |ctl| ctl['results'][0]['status'] == 'failed' }
control_hash = {}
failed_controls.each do |ctl|
@ -67,7 +69,10 @@ describe '3103 default methods for filter table' do
cmd += ' --controls ' + controls.join(' ')
cmd = inspec(cmd)
data = JSON.parse(cmd.stdout)
# RSpec keeps issuing a deprecation count to stdout
# See https://github.com/inspec/inspec/pull/3560
output = cmd.stdout.split("\n").reject {|line| line =~ /deprecation/}.join("\n")
data = JSON.parse(output)
failed_controls = data['profiles'][0]['controls'].select { |ctl| ctl['results'][0]['status'] == 'failed' }
control_hash = {}
failed_controls.each do |ctl|
@ -101,7 +106,10 @@ describe '2370 lazy_load for filter table' do
cmd += ' --controls ' + controls.join(' ')
cmd = inspec(cmd)
data = JSON.parse(cmd.stdout)
# RSpec keeps issuing a deprecation count to stdout
# See https://github.com/inspec/inspec/pull/3560
output = cmd.stdout.split("\n").reject {|line| line =~ /deprecation/}.join("\n")
data = JSON.parse(output)
failed_controls = data['profiles'][0]['controls'].select { |ctl| ctl['results'][0]['status'] == 'failed' }
control_hash = {}
failed_controls.each do |ctl|
@ -169,7 +177,10 @@ describe '3110 do not expose block-valued properties in raw data' do
cmd += ' --controls ' + controls.join(' ')
cmd = inspec(cmd)
data = JSON.parse(cmd.stdout)
# RSpec keeps issuing a deprecation count to stdout
# See https://github.com/inspec/inspec/pull/3560
output = cmd.stdout.split("\n").reject {|line| line =~ /deprecation/}.join("\n")
data = JSON.parse(output)
failed_controls = data['profiles'][0]['controls'].select { |ctl| ctl['results'][0]['status'] == 'failed' }
control_hash = {}
failed_controls.each do |ctl|

View file

@ -515,16 +515,6 @@ Test Summary: \e[38;5;41m2 successful\e[0m, 0 failures, 0 skipped\n"
end
end
describe 'when using a profile that calls .should explicitly' do
let(:run_result) { inspec('exec ' + File.join(profile_path, 'rspec-should-deprecation')) }
it 'should suppress the RSpec deprecation warning' do
# See: https://github.com/inspec/inspec/issues/952
run_result.exit_status.must_equal 0
run_result.stderr.must_be_empty
run_result.stdout.wont_include('1 deprecation warning total')
end
end
describe 'when targeting private GitHub profiles' do
let(:private_profile) {
URI.parse('https://github.com/chef/inspec-test-profile-private.git')

View file

@ -1,5 +0,0 @@
control 'call-should-as-an-explicit-method' do
describe 'It should work without issuing a deprecation warning' do
it { 'a string'.should include 'ing' }
end
end

View file

@ -1,8 +0,0 @@
name: rspec-should-deprecation
title: A profile to trigger an RSpec deprecation warning, refs github 952
maintainer: The Authors
copyright: The Authors
copyright_email: you@example.com
license: Apache-2.0
summary: An InSpec Compliance Profile
version: 0.1.0