Sha256: ebeb37189326f0f7031627f588bfbf82a1ee37051d6a4de708cba22cee04a35d

Contents?: true

Size: 1.79 KB

Versions: 27

Compression:

Stored size: 1.79 KB

Contents

require "spec_helper"

describe RSpec::Core::Deprecation do
  describe "#deprecate" do
    context "old API with individual args" do
      it "includes the method to deprecate" do
        expect(RSpec.configuration.reporter).to receive(:deprecation).with(hash_including :deprecated => "deprecated_method")
        RSpec.deprecate("deprecated_method")
      end

      it "includes the replacement when provided" do
        expect(RSpec.configuration.reporter).to receive(:deprecation).with(hash_including :deprecated => "deprecated_method", :replacement => "replacement")
        RSpec.deprecate("deprecated_method", "replacement")
      end

      it "adds the call site" do
        expect_deprecation_with_call_site(__FILE__, __LINE__ + 1)
        RSpec.deprecate("deprecated_method")
      end

      it "doesn't override the existing callsite" do
        expect(RSpec.configuration.reporter).to receive(:deprecation).with(hash_including :call_site => "/path")
        RSpec.deprecate("deprecated_method", :call_site => "/path")
      end
    end

    context "new API with a hash after the first arg" do
      it "passes the hash to the reporter" do
        expect(RSpec.configuration.reporter).to receive(:deprecation).with(hash_including :deprecated => "deprecated_method", :replacement => "replacement")
        RSpec.deprecate("deprecated_method", :replacement => "replacement")
      end

      it "adds the call site" do
        expect_deprecation_with_call_site(__FILE__, __LINE__ + 1)
        RSpec.deprecate("deprecated_method")
      end
    end
  end

  describe "#warn_deprecation" do
    it "puts message in a hash" do
      expect(RSpec.configuration.reporter).to receive(:deprecation).with(hash_including :message => "this is the message")
      RSpec.warn_deprecation("this is the message")
    end
  end
end

Version data entries

27 entries across 27 versions & 8 rubygems

Version Path
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.4.0/gems/rspec-core-2.14.8/spec/rspec/core/deprecation_spec.rb
vagrant-unbundled-1.9.5.1 vendor/bundle/ruby/2.4.0/gems/rspec-core-2.14.8/spec/rspec/core/deprecation_spec.rb
vagrant-unbundled-1.9.1.1 vendor/bundle/ruby/2.4.0/gems/rspec-core-2.14.8/spec/rspec/core/deprecation_spec.rb
vagrant-unbundled-1.8.5.2 vendor/bundle/ruby/2.3.0/gems/rspec-core-2.14.8/spec/rspec/core/deprecation_spec.rb
vagrant-unbundled-1.8.5.1 vendor/bundle/ruby/2.3.0/gems/rspec-core-2.14.8/spec/rspec/core/deprecation_spec.rb
vagrant-unbundled-1.8.4.2 vendor/bundle/ruby/2.3.0/gems/rspec-core-2.14.8/spec/rspec/core/deprecation_spec.rb
vagrant-unbundled-1.8.4.1 vendor/bundle/ruby/2.3.0/gems/rspec-core-2.14.8/spec/rspec/core/deprecation_spec.rb
vagrant-unbundled-1.8.1.1 vendor/bundle/ruby/2.3.0/gems/rspec-core-2.14.8/spec/rspec/core/deprecation_spec.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/rspec-core-2.14.8/spec/rspec/core/deprecation_spec.rb
dxruby_rp5-0.0.4 spec/vendor/rspec-core-2.14.7/spec/rspec/core/deprecation_spec.rb
rspec-core-2.14.8 spec/rspec/core/deprecation_spec.rb
mango-0.8.0 vendor/bundler/ruby/2.1.0/gems/rspec-core-2.14.7/spec/rspec/core/deprecation_spec.rb
mango-0.7.1 vendor/bundler/ruby/2.0.0/gems/rspec-core-2.14.7/spec/rspec/core/deprecation_spec.rb
dxruby_rp5-0.0.3 spec/vendor/rspec-core-2.14.7/spec/rspec/core/deprecation_spec.rb
tuktuk-rails-0.0.10 vendor/bundle/ruby/2.0.0/gems/rspec-core-2.14.7/spec/rspec/core/deprecation_spec.rb
tuktuk-rails-0.0.9 vendor/bundle/ruby/2.0.0/gems/rspec-core-2.14.7/spec/rspec/core/deprecation_spec.rb
tuktuk-rails-0.0.8 vendor/bundle/ruby/2.0.0/gems/rspec-core-2.14.7/spec/rspec/core/deprecation_spec.rb
tuktuk-rails-0.0.7 vendor/bundle/ruby/2.0.0/gems/rspec-core-2.14.7/spec/rspec/core/deprecation_spec.rb
dxruby_rp5-0.0.2 spec/vendor/rspec-core-2.14.7/spec/rspec/core/deprecation_spec.rb
dxruby_rp5-0.0.1 spec/vendor/rspec-core-2.14.7/spec/rspec/core/deprecation_spec.rb