aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorSean Griffin <sean@seantheprogrammer.com>2016-08-11 15:23:28 -0400
committerGitHub <noreply@github.com>2016-08-11 15:23:28 -0400
commitbe68f180917808597f2cc9bfa8f58a45b955504a (patch)
tree3e9731b5840d14052558bf2cb39f8cae3340a4e9 /activerecord
parent530d3f79ea2dbe0e638b512635297dfd37852a53 (diff)
parentbe9dc78fccc80bb5045c67b435b5c7e36ea8a296 (diff)
downloadrails-be68f180917808597f2cc9bfa8f58a45b955504a.tar.gz
rails-be68f180917808597f2cc9bfa8f58a45b955504a.tar.bz2
rails-be68f180917808597f2cc9bfa8f58a45b955504a.zip
Merge pull request #26124 from yahonda/diag26099
Creating a new Topic class instead of class_eval for the existing one
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/test/cases/validations_test.rb6
1 files changed, 2 insertions, 4 deletions
diff --git a/activerecord/test/cases/validations_test.rb b/activerecord/test/cases/validations_test.rb
index 76510cb80d..5d9aa99497 100644
--- a/activerecord/test/cases/validations_test.rb
+++ b/activerecord/test/cases/validations_test.rb
@@ -156,17 +156,15 @@ class ValidationsTest < ActiveRecord::TestCase
end
def test_numericality_validation_with_mutation
- Topic.class_eval do
+ klass = Class.new(Topic) do
attribute :wibble, :string
validates_numericality_of :wibble, only_integer: true
end
- topic = Topic.new(wibble: "123-4567")
+ topic = klass.new(wibble: "123-4567")
topic.wibble.gsub!("-", "")
assert topic.valid?
- ensure
- Topic.reset_column_information
end
def test_acceptance_validator_doesnt_require_db_connection