Sha256: 738701559d0c81cb751cc02a8693f0556a71762607324dd4b1adeef430115c49

Contents?: true

Size: 703 Bytes

Versions: 10

Compression:

Stored size: 703 Bytes

Contents

require 'unit_spec_helper'

describe Rpush::Deprecatable do
  class HasDeprecatedMethod
    include Rpush::Deprecatable

    def original_called?
      @called == true
    end

    def deprecated_method
      @called = true
    end
    deprecated(:deprecated_method, '4.0')
  end

  let(:klass) { HasDeprecatedMethod.new }

  before do
    Rpush::Deprecation.stub(:warn)
  end

  it 'warns the method is deprecated when called' do
    Rpush::Deprecation.should_receive(:warn).with("deprecated_method is deprecated and will be removed from Rpush 4.0.")
    klass.deprecated_method
  end

  it 'calls the original method' do
    klass.deprecated_method
    klass.original_called?.should be_true
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rpush-2.0.1-java spec/unit/deprecatable_spec.rb
rpush-2.0.1 spec/unit/deprecatable_spec.rb
rpush-2.0.0-java spec/unit/deprecatable_spec.rb
rpush-2.0.0 spec/unit/deprecatable_spec.rb
rpush-2.0.0.rc1-java spec/unit/deprecatable_spec.rb
rpush-2.0.0.rc1 spec/unit/deprecatable_spec.rb
rpush-2.0.0.beta2 spec/unit/deprecatable_spec.rb
rpush-2.0.0.beta1 spec/unit/deprecatable_spec.rb
rpush-1.0.0-java spec/unit/deprecatable_spec.rb
rpush-1.0.0 spec/unit/deprecatable_spec.rb