|
1 | 1 | require "spec_helper"
|
2 | 2 |
|
3 | 3 | # stree-ignore
|
4 |
| -constant_remappings = { |
5 |
| - "SuperDiff::ActiveRecord::ObjectInspection::InspectionTreeBuilders::ActiveRecordModel" => "SuperDiff::ActiveRecord::InspectionTreeBuilders::ActiveRecordModel", |
6 |
| - "SuperDiff::ActiveRecord::ObjectInspection::InspectionTreeBuilders::ActiveRecordRelation" => "SuperDiff::ActiveRecord::InspectionTreeBuilders::ActiveRecordRelation", |
7 |
| - "SuperDiff::ActiveSupport::ObjectInspection::InspectionTreeBuilders::HashWithIndifferentAccess" => "SuperDiff::ActiveSupport::InspectionTreeBuilders::HashWithIndifferentAccess", |
8 |
| - "SuperDiff::ActiveSupport::ObjectInspection::InspectionTreeBuilders::OrderedOptions" => "SuperDiff::ActiveSupport::InspectionTreeBuilders::OrderedOptions", |
| 4 | +common_constant_remappings = { |
9 | 5 | "SuperDiff::ColorizedDocumentExtensions" => "SuperDiff::Core::ColorizedDocumentExtensions",
|
10 | 6 | "SuperDiff::Configuration" => "SuperDiff::Core::Configuration",
|
11 | 7 | # TODO: Add back?
|
|
87 | 83 | "SuperDiff::TieredLinesFormatter" => "SuperDiff::Core::TieredLinesFormatter",
|
88 | 84 | }
|
89 | 85 |
|
90 |
| -constant_remappings.each do |old_constant_name, new_constant_name| |
| 86 | +# stree-ignore |
| 87 | +active_record_constant_remappings = { |
| 88 | + "SuperDiff::ActiveRecord::ObjectInspection::InspectionTreeBuilders::ActiveRecordModel" => "SuperDiff::ActiveRecord::InspectionTreeBuilders::ActiveRecordModel", |
| 89 | + "SuperDiff::ActiveRecord::ObjectInspection::InspectionTreeBuilders::ActiveRecordRelation" => "SuperDiff::ActiveRecord::InspectionTreeBuilders::ActiveRecordRelation", |
| 90 | +} |
| 91 | + |
| 92 | +# stree-ignore |
| 93 | +active_support_constant_remappings = { |
| 94 | + "SuperDiff::ActiveSupport::ObjectInspection::InspectionTreeBuilders::HashWithIndifferentAccess" => "SuperDiff::ActiveSupport::InspectionTreeBuilders::HashWithIndifferentAccess", |
| 95 | + "SuperDiff::ActiveSupport::ObjectInspection::InspectionTreeBuilders::OrderedOptions" => "SuperDiff::ActiveSupport::InspectionTreeBuilders::OrderedOptions", |
| 96 | +} |
| 97 | + |
| 98 | +common_constant_remappings.each do |old_constant_name, new_constant_name| |
91 | 99 | RSpec.describe old_constant_name, type: :unit do
|
92 | 100 | it "maps to #{new_constant_name}" do
|
93 | 101 | capture_warnings do
|
|
103 | 111 | end
|
104 | 112 | end
|
105 | 113 |
|
| 114 | +active_record_constant_remappings.each do |old_constant_name, new_constant_name| |
| 115 | + RSpec.describe old_constant_name, type: :unit, active_record: true do |
| 116 | + it "maps to #{new_constant_name}" do |
| 117 | + capture_warnings do |
| 118 | + expect(Object.const_get(old_constant_name)).to be( |
| 119 | + Object.const_get(new_constant_name) |
| 120 | + ) |
| 121 | + end |
| 122 | + end |
| 123 | + |
| 124 | + it "points users to #{new_constant_name} instead" do |
| 125 | + expect(old_constant_name).to be_deprecated_in_favor_of(new_constant_name) |
| 126 | + end |
| 127 | + end |
| 128 | +end |
| 129 | + |
| 130 | +active_support_constant_remappings.each do |old_constant_name, new_constant_name| |
| 131 | + RSpec.describe old_constant_name, type: :unit, active_support: true do |
| 132 | + it "maps to #{new_constant_name}" do |
| 133 | + capture_warnings do |
| 134 | + expect(Object.const_get(old_constant_name)).to be( |
| 135 | + Object.const_get(new_constant_name) |
| 136 | + ) |
| 137 | + end |
| 138 | + end |
| 139 | + |
| 140 | + it "points users to #{new_constant_name} instead" do |
| 141 | + expect(old_constant_name).to be_deprecated_in_favor_of(new_constant_name) |
| 142 | + end |
| 143 | + end |
| 144 | +end |
| 145 | + |
106 | 146 | RSpec.describe "SuperDiff::Differs::Main.call", type: :unit do
|
107 | 147 | it "maps to SuperDiff.diff" do
|
108 | 148 | capture_warnings do
|
|
0 commit comments