spec/deprecation_spec.rb in deprecation-1.0.0 vs spec/deprecation_spec.rb in deprecation-1.1.0

- old
+ new

@@ -7,38 +7,70 @@ self.deprecation_horizon = 'release 0.1' def a - 1 + 1 end deprecation_deprecate :a def b - + end def c end def d - + 4 end - + deprecation_deprecate :c, :d def e end deprecation_deprecate :e => { :deprecation_horizon => 'asdf 1.4' } + + + def f(x, foo: nil) + 7 + end + deprecation_deprecate :f end subject { DeprecationTest.new} describe "a" do it "should be deprecated" do expect { subject.a }.to raise_error /a is deprecated/ + end + end + + describe "a method that takes positional args and keyword args" do + around do |example| + # We need to suppress the raise behavior, so we can ensure the original method is called + DeprecationTest.deprecation_behavior = :silence + example.run + DeprecationTest.deprecation_behavior = :raise + end + + it "delegates to the original" do + expect(subject.f 9, foo: 3).to eq 7 + end + end + + describe "a method that takes no args" do + around do |example| + # We need to suppress the raise behavior, so we can ensure the original method is called + DeprecationTest.deprecation_behavior = :silence + example.run + DeprecationTest.deprecation_behavior = :raise + end + + it "delegates to the original" do + expect(subject.d).to eq 4 end end describe "b" do it "should not be deprecated" do