diff options
author | John Keiser <john@johnkeiser.com> | 2015-09-01 14:01:47 -0700 |
---|---|---|
committer | John Keiser <john@johnkeiser.com> | 2015-09-01 19:30:59 -0700 |
commit | 7c1287cd12fdfcdabe26c4a6e1d548edb0d0f35e (patch) | |
tree | 5b68f252a3706a97b94e8ecdd264dbca490c3569 | |
parent | 8379bcbdf656f09dbf62a6dfffed5217bf6a146f (diff) | |
download | chef-7c1287cd12fdfcdabe26c4a6e1d548edb0d0f35e.tar.gz |
Simplify deprecation spec
-rw-r--r-- | spec/unit/deprecation_spec.rb | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/spec/unit/deprecation_spec.rb b/spec/unit/deprecation_spec.rb index 2e1f3c39f3..674de5ec1d 100644 --- a/spec/unit/deprecation_spec.rb +++ b/spec/unit/deprecation_spec.rb @@ -65,19 +65,16 @@ describe Chef::Deprecation do end context 'deprecation warning messages' do - before(:each) do - @warning_output = [ ] - allow(Chef::Log).to receive(:warn) { |msg| @warning_output << msg } - end + RSpec::Matchers.define_negated_matcher :a_non_empty_array, :be_empty it 'should be enabled for deprecated methods' do + expect(Chef::Log).to receive(:warn).with(a_non_empty_array) TestClass.new.deprecated_method(10) - expect(@warning_output).not_to be_empty end it 'should contain stack trace' do + expect(Chef::Log).to receive(:warn).with(a_string_including(".rb")) TestClass.new.deprecated_method(10) - expect(@warning_output.join("").include?(".rb")).to be_truthy end end |