Sha256: 2287801a7e2485481c2ededf61130c7465a140929663e29fdccc890d7ff20539

Contents?: true

Size: 1.33 KB

Versions: 8

Compression:

Stored size: 1.33 KB

Contents

require 'spec_helper'

describe RSpec::Core do

  describe "#configuration" do

    it "returns the same object every time" do
      RSpec.configuration.should equal(RSpec.configuration)
    end

  end

  describe "#configure" do
    around(:each) do |example|
      RSpec.allowing_configure_warning(&example)
    end

    before(:each) do
      RSpec.stub(:warn)
    end

    it "yields the current configuration" do
      RSpec.configure do |config|
        config.should == RSpec::configuration
      end
    end

    context "when an example group has already been defined" do
      before(:each) do
        RSpec.world.stub(:example_groups).and_return([double.as_null_object])
      end

      it "prints a deprecation warning" do
        RSpec.should_receive(:warn).with(/configuration should happen before the first example group/)
        RSpec.configure { |c| }
      end
    end

    context "when no examples have been defined yet" do
      before(:each) do
        RSpec.world.stub(:example_groups).and_return([])
      end

      it "does not print a deprecation warning" do
        RSpec.should_not_receive(:warn)
        RSpec.configure { |c| }
      end
    end
  end

  describe "#world" do

    it "returns the RSpec::Core::World instance the current run is using" do
      RSpec.world.should be_instance_of(RSpec::Core::World)
    end

  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rspec-core-2.6.4 spec/rspec/core_spec.rb
rspec-core-2.6.3 spec/rspec/core_spec.rb
rspec-core-2.6.3.beta1 spec/rspec/core_spec.rb
rspec-core-2.6.2.rc spec/rspec/core_spec.rb
rspec-core-2.6.0 spec/rspec/core_spec.rb
rspec-core-2.6.0.rc6 spec/rspec/core_spec.rb
rspec-core-2.6.0.rc4 spec/rspec/core_spec.rb
rspec-core-2.6.0.rc2 spec/rspec/core_spec.rb