spec/deprecation_spec.rb in deprecation-0.0.5 vs spec/deprecation_spec.rb in deprecation-0.1.0
- old
+ new
@@ -72,6 +72,32 @@
it "should" do
expect { subject.a }.to raise_error /Callstack:/
end
end
+
+ describe "warn" do
+ class A
+ def some_deprecated_method
+ Deprecation.warn(A, "some explicit deprecation warning")
+ true
+ end
+
+ def old_method
+ some_deprecated_method
+ end
+ end
+
+ let(:logger) { double() }
+
+ before(:each) do
+ Deprecation.stub logger: logger
+ Deprecation.stub default_deprecation_behavior: :log
+ end
+
+ it "should provide a useful deprecation trace" do
+ logger.should_receive(:warn).with(/called from old_method/)
+ expect(A.new.old_method).to be_true
+
+ end
+ end
end