|
2 | 2 |
|
3 | 3 | describe RSpec::Core::Deprecation do
|
4 | 4 | describe "#deprecate" do
|
5 |
| - context "old API with individual args" do |
6 |
| - it "includes the method to deprecate" do |
7 |
| - expect(RSpec.configuration.reporter).to receive(:deprecation).with(hash_including :deprecated => "deprecated_method") |
8 |
| - RSpec.deprecate("deprecated_method") |
9 |
| - end |
10 |
| - |
11 |
| - it "includes the replacement when provided" do |
12 |
| - expect(RSpec.configuration.reporter).to receive(:deprecation).with(hash_including :deprecated => "deprecated_method", :replacement => "replacement") |
13 |
| - RSpec.deprecate("deprecated_method", "replacement") |
14 |
| - end |
15 |
| - |
16 |
| - it "adds the call site" do |
17 |
| - expect_deprecation_with_call_site(__FILE__, __LINE__ + 1) |
18 |
| - RSpec.deprecate("deprecated_method") |
19 |
| - end |
20 |
| - |
21 |
| - it "doesn't override the existing callsite" do |
22 |
| - expect(RSpec.configuration.reporter).to receive(:deprecation).with(hash_including :call_site => "/path") |
23 |
| - RSpec.deprecate("deprecated_method", :call_site => "/path") |
24 |
| - end |
| 5 | + it "passes the hash to the reporter" do |
| 6 | + expect(RSpec.configuration.reporter).to receive(:deprecation).with(hash_including :deprecated => "deprecated_method", :replacement => "replacement") |
| 7 | + RSpec.deprecate("deprecated_method", :replacement => "replacement") |
25 | 8 | end
|
26 | 9 |
|
27 |
| - context "new API with a hash after the first arg" do |
28 |
| - it "passes the hash to the reporter" do |
29 |
| - expect(RSpec.configuration.reporter).to receive(:deprecation).with(hash_including :deprecated => "deprecated_method", :replacement => "replacement") |
30 |
| - RSpec.deprecate("deprecated_method", :replacement => "replacement") |
31 |
| - end |
| 10 | + it "adds the call site" do |
| 11 | + expect_deprecation_with_call_site(__FILE__, __LINE__ + 1) |
| 12 | + RSpec.deprecate("deprecated_method") |
| 13 | + end |
32 | 14 |
|
33 |
| - it "adds the call site" do |
34 |
| - expect_deprecation_with_call_site(__FILE__, __LINE__ + 1) |
35 |
| - RSpec.deprecate("deprecated_method") |
36 |
| - end |
| 15 | + it "doesn't override a passed call site" do |
| 16 | + expect_deprecation_with_call_site("some_file.rb", 17) |
| 17 | + RSpec.deprecate("deprecated_method", :call_site => "/some_file.rb:17") |
37 | 18 | end
|
38 | 19 | end
|
39 | 20 |
|
|
0 commit comments