Sha256: 0d3f281748cb604eb53754916af8ae5ee4b0a01717e52ab01ed6c8ed80b05620

Contents?: true

Size: 978 Bytes

Versions: 6

Compression:

Stored size: 978 Bytes

Contents

require "spec_helper"

describe RSpec::Core::Deprecation do
  describe "#deprecate" 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

    it "doesn't override a passed call site" do
      expect_deprecation_with_call_site("some_file.rb", 17)
      RSpec.deprecate("deprecated_method", :call_site => "/some_file.rb:17")
    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

6 entries across 6 versions & 1 rubygems

Version Path
rspec-core-2.99.2 spec/rspec/core/deprecation_spec.rb
rspec-core-2.99.1 spec/rspec/core/deprecation_spec.rb
rspec-core-2.99.0 spec/rspec/core/deprecation_spec.rb
rspec-core-2.99.0.rc1 spec/rspec/core/deprecation_spec.rb
rspec-core-2.99.0.beta2 spec/rspec/core/deprecation_spec.rb
rspec-core-2.99.0.beta1 spec/rspec/core/deprecation_spec.rb