Skip to content

Commit 0a2b1c9

Browse files
authored
MONGOID-5293 put legacy_attributes in 7.5 defaults (#5425)
* MONGOID-5293 put legacy_attributes in 7.5 * switch order * MONGOID-5293 fix defaults tests
1 parent c1fd4c9 commit 0a2b1c9

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/mongoid/config/defaults.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ def load_defaults(version)
3939
load_defaults "7.4"
4040
when "7.4"
4141
# flags introduced in 7.5 - old functionality
42+
self.legacy_attributes = true
4243
self.overwrite_chained_operators = true
4344

4445
load_defaults "7.5"
4546
when "7.5"
4647
# flags introduced in 8.0 - old functionality
47-
self.legacy_attributes = true
4848
self.map_big_decimal_to_decimal128 = false
4949
when "8.0"
5050
# All flag defaults currently reflect 8.0 behavior.

spec/mongoid/config/defaults_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,26 +40,26 @@
4040

4141
shared_examples "turns off 7.5 flags" do
4242
it "turns off the 7.5 flags" do
43+
expect(Mongoid.legacy_attributes).to be true
4344
expect(Mongoid.overwrite_chained_operators).to be true
4445
end
4546
end
4647

4748
shared_examples "turns on 7.5 flags" do
4849
it "turns on the 7.5 flags" do
50+
expect(Mongoid.legacy_attributes).to be false
4951
expect(Mongoid.overwrite_chained_operators).to be false
5052
end
5153
end
5254

5355
shared_examples "turns off 8.0 flags" do
5456
it "turns off the 8.0 flags" do
55-
expect(Mongoid.legacy_attributes).to be true
5657
expect(Mongoid.map_big_decimal_to_decimal128).to be false
5758
end
5859
end
5960

6061
shared_examples "turns on 8.0 flags" do
6162
it "turns on the 8.0 flags" do
62-
expect(Mongoid.legacy_attributes).to be false
6363
expect(Mongoid.map_big_decimal_to_decimal128).to be true
6464
end
6565
end

0 commit comments

Comments
 (0)