Sha256: c4953724606a944c788f9f9dd47a6c437dcc42ac26945737d9ea954d0958b0d1

Contents?: true

Size: 1.33 KB

Versions: 1

Compression:

Stored size: 1.33 KB

Contents

require 'spec_helper'

describe Deprecation do
  class DeprecationTest
    extend Deprecation
    self.deprecation_behavior = :raise

    self.deprecation_horizon = 'release 0.1'


    def a
      1 
    end

    deprecation_deprecate :a

    def b
      
    end

    def c

    end

    def d

    end
    
    deprecation_deprecate :c, :d

    def e

    end
    deprecation_deprecate :e => { :deprecation_horizon => 'asdf 1.4' }
  end
  subject { DeprecationTest.new}

  describe "a" do
    it "should be deprecated" do
      expect { subject.a }.to raise_error /a is deprecated/
    end
  end

  describe "b" do
    it "should not be deprecated" do
      expect { subject.b }.not_to raise_error /b is deprecated/
    end
  end

  describe "c,d" do
    it "should be deprecated" do
      expect { subject.c }.to raise_error /c is deprecated/
      expect { subject.d }.to raise_error /d is deprecated/
    end
  end

  describe "e" do
    it "should be deprecated in asdf 1.4" do
      expect { subject.e }.to raise_error /e is deprecated and will be removed from asdf 1.4/
    end
  end

  describe "full callstack" do
    before(:all) do
      Deprecation.show_full_callstack = true
    end

    after(:all) do
      Deprecation.show_full_callstack = false
    end

    it "should" do
      expect { subject.a }.to raise_error /Callstack:/
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
deprecation-0.0.5 spec/deprecation_spec.rb