Skip to content

Commit be9dc78

Browse files
committed
Creating a new Topic class instead of class_eval for the existing one
since it affects another test `ReflectionTest#test_read_attribute_names` Address rails#26099
1 parent b9f71e4 commit be9dc78

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

activerecord/test/cases/validations_test.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,17 +156,15 @@ def test_validators
156156
end
157157

158158
def test_numericality_validation_with_mutation
159-
Topic.class_eval do
159+
klass = Class.new(Topic) do
160160
attribute :wibble, :string
161161
validates_numericality_of :wibble, only_integer: true
162162
end
163163

164-
topic = Topic.new(wibble: "123-4567")
164+
topic = klass.new(wibble: "123-4567")
165165
topic.wibble.gsub!("-", "")
166166

167167
assert topic.valid?
168-
ensure
169-
Topic.reset_column_information
170168
end
171169

172170
def test_acceptance_validator_doesnt_require_db_connection

0 commit comments

Comments
 (0)