summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Keiser <john@johnkeiser.com>2015-09-01 14:01:47 -0700
committerJohn Keiser <john@johnkeiser.com>2015-09-01 19:30:59 -0700
commit7c1287cd12fdfcdabe26c4a6e1d548edb0d0f35e (patch)
tree5b68f252a3706a97b94e8ecdd264dbca490c3569
parent8379bcbdf656f09dbf62a6dfffed5217bf6a146f (diff)
downloadchef-7c1287cd12fdfcdabe26c4a6e1d548edb0d0f35e.tar.gz
Simplify deprecation spec
-rw-r--r--spec/unit/deprecation_spec.rb9
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