/
deprecations_spec.rb
66 lines (57 loc) · 1.64 KB
/
deprecations_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
60
61
62
63
64
65
66
require "spec_helper"
describe "deprecations" do
describe "Spec" do
it "is deprecated" do
RSpec.should_receive(:warn_deprecation).with(/Spec .* RSpec/i)
Spec
end
it "returns RSpec" do
RSpec.stub(:warn_deprecation)
Spec.should eq(RSpec)
end
it "doesn't include backward compatibility in const_missing backtrace" do
RSpec.stub(:warn_deprecation)
exception = nil
begin
ConstantThatDoesNotExist
rescue Exception => exception
end
exception.backtrace.find { |l| l =~ /lib\/rspec\/core\/backward_compatibility/ }.should be_nil
end
end
describe RSpec::Core::ExampleGroup do
describe 'running_example' do
it 'is deprecated' do
RSpec.should_receive(:warn_deprecation)
self.running_example
end
it "delegates to example" do
RSpec.stub(:warn_deprecation)
running_example.should eq(example)
end
end
end
describe "Spec::Runner.configure" do
it "is deprecated" do
RSpec.stub(:warn_deprecation)
RSpec.should_receive(:deprecate)
Spec::Runner.configure
end
end
describe "Spec::Rake::SpecTask" do
it "is deprecated" do
RSpec.stub(:warn_deprecation)
RSpec.should_receive(:deprecate)
Spec::Rake::SpecTask
end
it "doesn't include backward compatibility in const_missing backtrace" do
RSpec.stub(:warn_deprecation)
exception = nil
begin
Spec::Rake::ConstantThatDoesNotExist
rescue Exception => exception
end
exception.backtrace.find { |l| l =~ /lib\/rspec\/core\/backward_compatibility/ }.should be_nil
end
end
end