Skip to content

Commit 228f351

Browse files
committed
Fix JSON test leaking constants
1 parent 851b9d4 commit 228f351

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

activesupport/test/json/encoding_test.rb

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -316,13 +316,14 @@ def test_array_as_json_without_options
316316
assert_equal([:default], json)
317317
end
318318

319+
UserNameAndEmail = Struct.new(:name, :email)
320+
UserNameAndDate = Struct.new(:name, :date)
321+
Custom = Struct.new(:name, :sub)
322+
319323
def test_struct_encoding
320-
Struct.new("UserNameAndEmail", :name, :email)
321-
Struct.new("UserNameAndDate", :name, :date)
322-
Struct.new("Custom", :name, :sub)
323-
user_email = Struct::UserNameAndEmail.new "David", "[email protected]"
324-
user_birthday = Struct::UserNameAndDate.new "David", Date.new(2010, 01, 01)
325-
custom = Struct::Custom.new "David", user_birthday
324+
user_email = UserNameAndEmail.new "David", "[email protected]"
325+
user_birthday = UserNameAndDate.new "David", Date.new(2010, 01, 01)
326+
custom = Custom.new "David", user_birthday
326327

327328
json_strings = ""
328329
json_string_and_date = ""

0 commit comments

Comments
 (0)