/
core_spec.rb
59 lines (44 loc) · 1.33 KB
/
core_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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