Sha256: 2306e06f3fa32350f8aaeafcac7529fb1b15ab2fd1f87fb30e18faf3dcd90ab6

Contents?: true

Size: 1.5 KB

Versions: 6

Compression:

Stored size: 1.5 KB

Contents

require "spec_helper"

describe "deprecated methods" do
  describe "Spec" do
    it "is deprecated" do
      RSpec.should_receive(:deprecate)
      Spec
    end

    it "returns RSpec" do
      RSpec.stub(:deprecate)
      expect(Spec).to eq(RSpec)
    end

    it "doesn't include backward compatibility in const_missing backtrace" do
      RSpec.stub(:deprecate)
      exception = nil
      begin
        ConstantThatDoesNotExist
      rescue Exception => exception
      end
      expect(exception.backtrace.find { |l| l =~ /lib\/rspec\/core\/backward_compatibility/ }).to be_nil
    end
  end

  describe RSpec::Core::SharedExampleGroup do
    describe 'share_as' do
      it 'is deprecated' do
        RSpec.should_receive(:deprecate).at_least(:once)
        RSpec::Core::SharedExampleGroup.share_as(:DeprecatedSharedConst) {}
      end
    end
  end

  describe "Spec::Runner.configure" do
    it "is deprecated" do
      RSpec.should_receive(:deprecate).at_least(:once)
      Spec::Runner.configure
    end
  end

  describe "Spec::Rake::SpecTask" do
    it "is deprecated" do
      RSpec.should_receive(:deprecate).at_least(:once)
      Spec::Rake::SpecTask
    end

    it "doesn't include backward compatibility in const_missing backtrace" do
      RSpec.stub(:deprecate)
      exception = nil
      begin
        Spec::Rake::ConstantThatDoesNotExist
      rescue Exception => exception
      end
      expect(exception.backtrace.find { |l| l =~ /lib\/rspec\/core\/backward_compatibility/ }).to be_nil
    end
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

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