mirror of https://github.com/rails/rails
Revert "No such class since 8d2866bb80fbe81acb04f5b0c44f152f571fb29f"
This reverts commit dd779c9686
.
This commit is contained in:
parent
967beb7229
commit
0e62667047
|
@ -4,7 +4,7 @@ require "cases/helper"
|
|||
require "active_support/core_ext/hash/indifferent_access"
|
||||
require "active_support/hash_with_indifferent_access"
|
||||
|
||||
class AttributeAssignmentTest < ActiveSupport::TestCase
|
||||
class AttributeAssignmentTest < ActiveModel::TestCase
|
||||
class Model
|
||||
include ActiveModel::AttributeAssignment
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ class ModelWithoutAttributesMethod
|
|||
include ActiveModel::AttributeMethods
|
||||
end
|
||||
|
||||
class AttributeMethodsTest < ActiveSupport::TestCase
|
||||
class AttributeMethodsTest < ActiveModel::TestCase
|
||||
test "method missing works correctly even if attributes method is not defined" do
|
||||
assert_raises(NoMethodError) { ModelWithoutAttributesMethod.new.foo }
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@ require "cases/helper"
|
|||
require "active_model/attribute_set"
|
||||
|
||||
module ActiveModel
|
||||
class AttributeSetTest < ActiveSupport::TestCase
|
||||
class AttributeSetTest < ActiveModel::TestCase
|
||||
test "building a new set from raw attributes" do
|
||||
builder = AttributeSet::Builder.new(foo: Type::Integer.new, bar: Type::Float.new)
|
||||
attributes = builder.build_from_database(foo: "1.1", bar: "2.2")
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
require "cases/helper"
|
||||
|
||||
module ActiveModel
|
||||
class AttributeTest < ActiveSupport::TestCase
|
||||
class AttributeTest < ActiveModel::TestCase
|
||||
setup do
|
||||
@type = Minitest::Mock.new
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require "cases/helper"
|
||||
|
||||
class AttributesDirtyTest < ActiveSupport::TestCase
|
||||
class AttributesDirtyTest < ActiveModel::TestCase
|
||||
class DirtyModel
|
||||
include ActiveModel::Model
|
||||
include ActiveModel::Attributes
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
require "cases/helper"
|
||||
|
||||
module ActiveModel
|
||||
class AttributesTest < ActiveSupport::TestCase
|
||||
class AttributesTest < ActiveModel::TestCase
|
||||
class ModelForAttributesTest
|
||||
include ActiveModel::Model
|
||||
include ActiveModel::Attributes
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require "cases/helper"
|
||||
|
||||
class CallbacksTest < ActiveSupport::TestCase
|
||||
class CallbacksTest < ActiveModel::TestCase
|
||||
class CallbackValidator
|
||||
def around_create(model)
|
||||
model.callbacks << :before_around_create
|
||||
|
|
|
@ -4,7 +4,7 @@ require "cases/helper"
|
|||
require "models/contact"
|
||||
require "models/helicopter"
|
||||
|
||||
class ConversionTest < ActiveSupport::TestCase
|
||||
class ConversionTest < ActiveModel::TestCase
|
||||
test "to_model default implementation returns self" do
|
||||
contact = Contact.new
|
||||
assert_equal contact, contact.to_model
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require "cases/helper"
|
||||
|
||||
class DirtyTest < ActiveSupport::TestCase
|
||||
class DirtyTest < ActiveModel::TestCase
|
||||
class DirtyModel
|
||||
include ActiveModel::Dirty
|
||||
define_attribute_methods :name, :color, :size, :status
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
require "cases/helper"
|
||||
require "active_model/error"
|
||||
|
||||
class ErrorTest < ActiveSupport::TestCase
|
||||
class ErrorTest < ActiveModel::TestCase
|
||||
class Person
|
||||
extend ActiveModel::Naming
|
||||
def initialize
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
require "cases/helper"
|
||||
require "yaml"
|
||||
|
||||
class ErrorsTest < ActiveSupport::TestCase
|
||||
class ErrorsTest < ActiveModel::TestCase
|
||||
class Person
|
||||
extend ActiveModel::Naming
|
||||
def initialize
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require "cases/helper"
|
||||
|
||||
class LintTest < ActiveSupport::TestCase
|
||||
class LintTest < ActiveModel::TestCase
|
||||
include ActiveModel::Lint::Tests
|
||||
|
||||
class CompliantModel
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require "cases/helper"
|
||||
|
||||
class ModelTest < ActiveSupport::TestCase
|
||||
class ModelTest < ActiveModel::TestCase
|
||||
include ActiveModel::Lint::Tests
|
||||
|
||||
module DefaultValue
|
||||
|
|
|
@ -6,7 +6,7 @@ require "models/sheep"
|
|||
require "models/track_back"
|
||||
require "models/blog_post"
|
||||
|
||||
class NamingTest < ActiveSupport::TestCase
|
||||
class NamingTest < ActiveModel::TestCase
|
||||
def setup
|
||||
@model_name = ActiveModel::Name.new(Post::TrackBack)
|
||||
end
|
||||
|
@ -44,7 +44,7 @@ class NamingTest < ActiveSupport::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
class NamingWithNamespacedModelInIsolatedNamespaceTest < ActiveSupport::TestCase
|
||||
class NamingWithNamespacedModelInIsolatedNamespaceTest < ActiveModel::TestCase
|
||||
def setup
|
||||
@model_name = ActiveModel::Name.new(Blog::Post, Blog)
|
||||
end
|
||||
|
@ -82,7 +82,7 @@ class NamingWithNamespacedModelInIsolatedNamespaceTest < ActiveSupport::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
class NamingWithNamespacedModelInSharedNamespaceTest < ActiveSupport::TestCase
|
||||
class NamingWithNamespacedModelInSharedNamespaceTest < ActiveModel::TestCase
|
||||
def setup
|
||||
@model_name = ActiveModel::Name.new(Blog::Post)
|
||||
end
|
||||
|
@ -120,7 +120,7 @@ class NamingWithNamespacedModelInSharedNamespaceTest < ActiveSupport::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
class NamingWithSuppliedModelNameTest < ActiveSupport::TestCase
|
||||
class NamingWithSuppliedModelNameTest < ActiveModel::TestCase
|
||||
def setup
|
||||
@model_name = ActiveModel::Name.new(Blog::Post, nil, "Article")
|
||||
end
|
||||
|
@ -158,7 +158,7 @@ class NamingWithSuppliedModelNameTest < ActiveSupport::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
class NamingUsingRelativeModelNameTest < ActiveSupport::TestCase
|
||||
class NamingUsingRelativeModelNameTest < ActiveModel::TestCase
|
||||
def setup
|
||||
@model_name = Blog::Post.model_name
|
||||
end
|
||||
|
@ -196,7 +196,7 @@ class NamingUsingRelativeModelNameTest < ActiveSupport::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
class NamingHelpersTest < ActiveSupport::TestCase
|
||||
class NamingHelpersTest < ActiveModel::TestCase
|
||||
def setup
|
||||
@klass = Contact
|
||||
@record = @klass.new
|
||||
|
@ -262,7 +262,7 @@ class NamingHelpersTest < ActiveSupport::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
class NameWithAnonymousClassTest < ActiveSupport::TestCase
|
||||
class NameWithAnonymousClassTest < ActiveModel::TestCase
|
||||
def test_anonymous_class_without_name_argument
|
||||
assert_raises(ArgumentError) do
|
||||
ActiveModel::Name.new(Class.new)
|
||||
|
@ -275,7 +275,7 @@ class NameWithAnonymousClassTest < ActiveSupport::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
class NamingMethodDelegationTest < ActiveSupport::TestCase
|
||||
class NamingMethodDelegationTest < ActiveModel::TestCase
|
||||
def test_model_name
|
||||
assert_equal Blog::Post.model_name, Blog::Post.new.model_name
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@ require "active_model/nested_error"
|
|||
require "models/topic"
|
||||
require "models/reply"
|
||||
|
||||
class NestedErrorTest < ActiveSupport::TestCase
|
||||
class NestedErrorTest < ActiveModel::TestCase
|
||||
def test_initialize
|
||||
topic = Topic.new
|
||||
inner_error = ActiveModel::Error.new(topic, :title, :not_enough, count: 2)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
require "cases/helper"
|
||||
require "active_support/testing/isolation"
|
||||
|
||||
class RailtieTest < ActiveSupport::TestCase
|
||||
class RailtieTest < ActiveModel::TestCase
|
||||
include ActiveSupport::Testing::Isolation
|
||||
|
||||
def setup
|
||||
|
|
|
@ -4,7 +4,7 @@ require "cases/helper"
|
|||
require "models/user"
|
||||
require "models/visitor"
|
||||
|
||||
class SecurePasswordTest < ActiveSupport::TestCase
|
||||
class SecurePasswordTest < ActiveModel::TestCase
|
||||
setup do
|
||||
# Used only to speed up tests
|
||||
@original_min_cost = ActiveModel::SecurePassword.min_cost
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
require "cases/helper"
|
||||
require "active_support/core_ext/object/instance_variables"
|
||||
|
||||
class SerializationTest < ActiveSupport::TestCase
|
||||
class SerializationTest < ActiveModel::TestCase
|
||||
class User
|
||||
include ActiveModel::Serialization
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ require "cases/helper"
|
|||
require "models/contact"
|
||||
require "active_support/core_ext/object/instance_variables"
|
||||
|
||||
class JsonSerializationTest < ActiveSupport::TestCase
|
||||
class JsonSerializationTest < ActiveModel::TestCase
|
||||
def setup
|
||||
@contact = Contact.new
|
||||
@contact.name = "Konata Izumi"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
require "cases/helper"
|
||||
require "models/person"
|
||||
|
||||
class ActiveModelI18nTests < ActiveSupport::TestCase
|
||||
class ActiveModelI18nTests < ActiveModel::TestCase
|
||||
def setup
|
||||
I18n.backend = I18n::Backend::Simple.new
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@ require "cases/helper"
|
|||
|
||||
module ActiveModel
|
||||
module Type
|
||||
class BigIntegerTest < ActiveSupport::TestCase
|
||||
class BigIntegerTest < ActiveModel::TestCase
|
||||
def test_type_cast_big_integer
|
||||
type = Type::BigInteger.new
|
||||
assert_equal 1, type.cast(1)
|
||||
|
|
|
@ -4,7 +4,7 @@ require "cases/helper"
|
|||
|
||||
module ActiveModel
|
||||
module Type
|
||||
class BinaryTest < ActiveSupport::TestCase
|
||||
class BinaryTest < ActiveModel::TestCase
|
||||
def test_type_cast_binary
|
||||
type = Type::Binary.new
|
||||
assert_nil type.cast(nil)
|
||||
|
|
|
@ -4,7 +4,7 @@ require "cases/helper"
|
|||
|
||||
module ActiveModel
|
||||
module Type
|
||||
class BooleanTest < ActiveSupport::TestCase
|
||||
class BooleanTest < ActiveModel::TestCase
|
||||
def test_type_cast_boolean
|
||||
type = Type::Boolean.new
|
||||
assert_predicate type.cast(""), :nil?
|
||||
|
|
|
@ -4,7 +4,7 @@ require "cases/helper"
|
|||
|
||||
module ActiveModel
|
||||
module Type
|
||||
class DateTest < ActiveSupport::TestCase
|
||||
class DateTest < ActiveModel::TestCase
|
||||
def test_type_cast_date
|
||||
type = Type::Date.new
|
||||
assert_nil type.cast(nil)
|
||||
|
|
|
@ -4,7 +4,7 @@ require "cases/helper"
|
|||
|
||||
module ActiveModel
|
||||
module Type
|
||||
class DateTimeTest < ActiveSupport::TestCase
|
||||
class DateTimeTest < ActiveModel::TestCase
|
||||
def test_type_cast_datetime_and_timestamp
|
||||
type = Type::DateTime.new
|
||||
assert_nil type.cast(nil)
|
||||
|
|
|
@ -4,7 +4,7 @@ require "cases/helper"
|
|||
|
||||
module ActiveModel
|
||||
module Type
|
||||
class DecimalTest < ActiveSupport::TestCase
|
||||
class DecimalTest < ActiveModel::TestCase
|
||||
def test_type_cast_decimal
|
||||
type = Decimal.new
|
||||
assert_equal BigDecimal("0"), type.cast(BigDecimal("0"))
|
||||
|
|
|
@ -4,7 +4,7 @@ require "cases/helper"
|
|||
|
||||
module ActiveModel
|
||||
module Type
|
||||
class FloatTest < ActiveSupport::TestCase
|
||||
class FloatTest < ActiveModel::TestCase
|
||||
def test_type_cast_float
|
||||
type = Type::Float.new
|
||||
assert_equal 1.0, type.cast("1")
|
||||
|
|
|
@ -4,7 +4,7 @@ require "cases/helper"
|
|||
|
||||
module ActiveModel
|
||||
module Type
|
||||
class ImmutableStringTest < ActiveSupport::TestCase
|
||||
class ImmutableStringTest < ActiveModel::TestCase
|
||||
test "cast strings are frozen" do
|
||||
s = "foo"
|
||||
type = Type::ImmutableString.new
|
||||
|
|
|
@ -5,7 +5,7 @@ require "active_support/core_ext/numeric/time"
|
|||
|
||||
module ActiveModel
|
||||
module Type
|
||||
class IntegerTest < ActiveSupport::TestCase
|
||||
class IntegerTest < ActiveModel::TestCase
|
||||
test "simple values" do
|
||||
type = Type::Integer.new
|
||||
assert_nil type.cast("")
|
||||
|
|
|
@ -4,7 +4,7 @@ require "cases/helper"
|
|||
|
||||
module ActiveModel
|
||||
module Type
|
||||
class RegistryTest < ActiveSupport::TestCase
|
||||
class RegistryTest < ActiveModel::TestCase
|
||||
test "a class can be registered for a symbol" do
|
||||
registry = Type::Registry.new
|
||||
registry.register(:foo, ::String)
|
||||
|
|
|
@ -4,7 +4,7 @@ require "cases/helper"
|
|||
|
||||
module ActiveModel
|
||||
module Type
|
||||
class StringTest < ActiveSupport::TestCase
|
||||
class StringTest < ActiveModel::TestCase
|
||||
test "type casting" do
|
||||
type = Type::String.new
|
||||
assert_equal "t", type.cast(true)
|
||||
|
|
|
@ -4,7 +4,7 @@ require "cases/helper"
|
|||
|
||||
module ActiveModel
|
||||
module Type
|
||||
class TimeTest < ActiveSupport::TestCase
|
||||
class TimeTest < ActiveModel::TestCase
|
||||
def test_type_cast_time
|
||||
type = Type::Time.new
|
||||
assert_nil type.cast(nil)
|
||||
|
|
|
@ -4,7 +4,7 @@ require "cases/helper"
|
|||
|
||||
module ActiveModel
|
||||
module Type
|
||||
class ValueTest < ActiveSupport::TestCase
|
||||
class ValueTest < ActiveModel::TestCase
|
||||
def test_type_equality
|
||||
assert_equal Type::Value.new, Type::Value.new
|
||||
assert_not_equal Type::Value.new, Type::Integer.new
|
||||
|
|
|
@ -5,7 +5,7 @@ require "models/topic"
|
|||
require "models/person"
|
||||
require "models/custom_reader"
|
||||
|
||||
class AbsenceValidationTest < ActiveSupport::TestCase
|
||||
class AbsenceValidationTest < ActiveModel::TestCase
|
||||
teardown do
|
||||
Topic.clear_validators!
|
||||
Person.clear_validators!
|
||||
|
|
|
@ -6,7 +6,7 @@ require "models/topic"
|
|||
require "models/reply"
|
||||
require "models/person"
|
||||
|
||||
class AcceptanceValidationTest < ActiveSupport::TestCase
|
||||
class AcceptanceValidationTest < ActiveModel::TestCase
|
||||
teardown do
|
||||
self.class.send(:remove_const, :TestClass)
|
||||
end
|
||||
|
|
|
@ -85,7 +85,7 @@ class DogValidatorWithIfCondition < Dog
|
|||
def set_after_validation_marker2; history << "after_validation_marker2" ; end
|
||||
end
|
||||
|
||||
class CallbacksWithMethodNamesShouldBeCalled < ActiveSupport::TestCase
|
||||
class CallbacksWithMethodNamesShouldBeCalled < ActiveModel::TestCase
|
||||
def test_if_condition_is_respected_for_before_validation
|
||||
d = DogValidatorWithIfCondition.new
|
||||
d.valid?
|
||||
|
|
|
@ -4,7 +4,7 @@ require "cases/helper"
|
|||
|
||||
require "models/topic"
|
||||
|
||||
class ConditionalValidationTest < ActiveSupport::TestCase
|
||||
class ConditionalValidationTest < ActiveModel::TestCase
|
||||
def teardown
|
||||
Topic.clear_validators!
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@ require "cases/helper"
|
|||
require "models/topic"
|
||||
require "models/person"
|
||||
|
||||
class ConfirmationValidationTest < ActiveSupport::TestCase
|
||||
class ConfirmationValidationTest < ActiveModel::TestCase
|
||||
def teardown
|
||||
Topic.clear_validators!
|
||||
end
|
||||
|
|
|
@ -6,7 +6,7 @@ require "active_support/core_ext/numeric/time"
|
|||
require "models/topic"
|
||||
require "models/person"
|
||||
|
||||
class ExclusionValidationTest < ActiveSupport::TestCase
|
||||
class ExclusionValidationTest < ActiveModel::TestCase
|
||||
def teardown
|
||||
Topic.clear_validators!
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@ require "cases/helper"
|
|||
require "models/topic"
|
||||
require "models/person"
|
||||
|
||||
class FormatValidationTest < ActiveSupport::TestCase
|
||||
class FormatValidationTest < ActiveModel::TestCase
|
||||
def teardown
|
||||
Topic.clear_validators!
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@ require "cases/helper"
|
|||
|
||||
require "models/person"
|
||||
|
||||
class I18nGenerateMessageValidationTest < ActiveSupport::TestCase
|
||||
class I18nGenerateMessageValidationTest < ActiveModel::TestCase
|
||||
def setup
|
||||
Person.clear_validators!
|
||||
@person = Person.new
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
require "cases/helper"
|
||||
require "models/person"
|
||||
|
||||
class I18nValidationTest < ActiveSupport::TestCase
|
||||
class I18nValidationTest < ActiveModel::TestCase
|
||||
def setup
|
||||
Person.clear_validators!
|
||||
@person = person_class.new
|
||||
|
|
|
@ -5,7 +5,7 @@ require "cases/helper"
|
|||
require "models/topic"
|
||||
require "models/person"
|
||||
|
||||
class InclusionValidationTest < ActiveSupport::TestCase
|
||||
class InclusionValidationTest < ActiveModel::TestCase
|
||||
def teardown
|
||||
Topic.clear_validators!
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@ require "cases/helper"
|
|||
require "models/topic"
|
||||
require "models/person"
|
||||
|
||||
class LengthValidationTest < ActiveSupport::TestCase
|
||||
class LengthValidationTest < ActiveModel::TestCase
|
||||
def teardown
|
||||
Topic.clear_validators!
|
||||
end
|
||||
|
|
|
@ -8,7 +8,7 @@ require "models/person"
|
|||
require "bigdecimal"
|
||||
require "active_support/core_ext/big_decimal"
|
||||
|
||||
class NumericalityValidationTest < ActiveSupport::TestCase
|
||||
class NumericalityValidationTest < ActiveModel::TestCase
|
||||
def teardown
|
||||
Topic.clear_validators!
|
||||
end
|
||||
|
|
|
@ -6,7 +6,7 @@ require "models/topic"
|
|||
require "models/person"
|
||||
require "models/custom_reader"
|
||||
|
||||
class PresenceValidationTest < ActiveSupport::TestCase
|
||||
class PresenceValidationTest < ActiveModel::TestCase
|
||||
teardown do
|
||||
Topic.clear_validators!
|
||||
Person.clear_validators!
|
||||
|
|
|
@ -6,7 +6,7 @@ require "models/topic"
|
|||
require "models/person_with_validator"
|
||||
require "validators/namespace/email_validator"
|
||||
|
||||
class ValidatesTest < ActiveSupport::TestCase
|
||||
class ValidatesTest < ActiveModel::TestCase
|
||||
setup :reset_callbacks
|
||||
teardown :reset_callbacks
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ require "cases/helper"
|
|||
|
||||
require "models/topic"
|
||||
|
||||
class ValidationsContextTest < ActiveSupport::TestCase
|
||||
class ValidationsContextTest < ActiveModel::TestCase
|
||||
def teardown
|
||||
Topic.clear_validators!
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@ require "cases/helper"
|
|||
|
||||
require "models/topic"
|
||||
|
||||
class ValidatesWithTest < ActiveSupport::TestCase
|
||||
class ValidatesWithTest < ActiveModel::TestCase
|
||||
def teardown
|
||||
Topic.clear_validators!
|
||||
end
|
||||
|
|
|
@ -9,7 +9,7 @@ require "models/custom_reader"
|
|||
require "active_support/json"
|
||||
require "active_support/xml_mini"
|
||||
|
||||
class ValidationsTest < ActiveSupport::TestCase
|
||||
class ValidationsTest < ActiveModel::TestCase
|
||||
class CustomStrictValidationException < StandardError; end
|
||||
|
||||
def teardown
|
||||
|
|
Loading…
Reference in New Issue