Use Minitest::Test instead of ActiveModel::TestCase

This commit is contained in:
Santiago Pastorino
2014-01-09 21:52:10 -02:00
parent cec7980208
commit 1ec499bd64
19 changed files with 36 additions and 36 deletions

View File

@@ -3,7 +3,7 @@ require 'test_helper'
module ActiveModel
class Serializer
class Association
class BuildSerializerTest < ActiveModel::TestCase
class BuildSerializerTest < Minitest::Test
def setup
@association = Association::HasOne.new('post', serializer: PostSerializer)
@post = Post.new({ title: 'Title 1', body: 'Body 1', date: '1/1/2000' })

View File

@@ -2,7 +2,7 @@ require 'test_helper'
module ActiveModel
class Serializer
class AssociationsTest < ActiveModel::TestCase
class AssociationsTest < Minitest::Test
def test_associations_inheritance
inherited_serializer_klass = Class.new(PostSerializer) do
has_many :users

View File

@@ -2,7 +2,7 @@ require 'test_helper'
module ActiveModel
class Serializer
class AttributesTest < ActiveModel::TestCase
class AttributesTest < Minitest::Test
def setup
@profile = Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' })
@profile_serializer = ProfileSerializer.new(@profile)

View File

@@ -3,7 +3,7 @@ require 'test_helper'
module ActiveModel
class Serializer
class Config
class Test < ActiveModel::TestCase
class Test < Minitest::Test
def test_config_const_is_an_instance_of_config
assert_kind_of Config, CONFIG
end
@@ -30,9 +30,9 @@ module ActiveModel
end
end
class ConfigTest < ActiveModel::TestCase
class ConfigTest < Minitest::Test
def test_setup
ActiveModel::Serializer.setup do |config|
Serializer.setup do |config|
config.a = 'v1'
config.b = 'v2'
end
@@ -44,7 +44,7 @@ module ActiveModel
end
def test_config_accessors
ActiveModel::Serializer.setup do |config|
Serializer.setup do |config|
config.foo = 'v1'
config.bar = 'v2'
end
@@ -63,7 +63,7 @@ module ActiveModel
end
end
class ApplyConfigTest < ActiveModel::TestCase
class ApplyConfigTest < Minitest::Test
def test_apply_config_to_associations
CONFIG.embed = :ids
CONFIG.embed_in_root = true

View File

@@ -2,7 +2,7 @@ require 'test_helper'
module ActiveModel
class Serializer
class FilterAttributesTest < ActiveModel::TestCase
class FilterAttributesTest < Minitest::Test
def setup
@profile = Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' })
@profile_serializer = ProfileSerializer.new(@profile)
@@ -20,7 +20,7 @@ module ActiveModel
end
end
class FilterAssociationsTest < ActiveModel::TestCase
class FilterAssociationsTest < Minitest::Test
def setup
@association = PostSerializer._associations[:comments]
@old_association = @association.dup

View File

@@ -2,7 +2,7 @@ require 'test_helper'
module ActiveModel
class Serializer
class HasManyTest < ActiveModel::TestCase
class HasManyTest < Minitest::Test
def setup
@association = PostSerializer._associations[:comments]
@old_association = @association.dup
@@ -128,7 +128,7 @@ module ActiveModel
def test_associations_using_a_given_serializer
@association.embed = :ids
@association.embed_in_root = true
@association.serializer_from_options = Class.new(ActiveModel::Serializer) do
@association.serializer_from_options = Class.new(Serializer) do
def content
object.read_attribute_for_serialization(:content) + '!'
end
@@ -145,7 +145,7 @@ module ActiveModel
def test_associations_embedding_ids_using_a_given_array_serializer
@association.embed = :ids
@association.embed_in_root = true
@association.serializer_from_options = Class.new(ActiveModel::ArraySerializer) do
@association.serializer_from_options = Class.new(ArraySerializer) do
def serializable_object
{ my_content: ['fake'] }
end
@@ -158,7 +158,7 @@ module ActiveModel
end
def test_associations_embedding_objects_using_a_given_array_serializer
@association.serializer_from_options = Class.new(ActiveModel::ArraySerializer) do
@association.serializer_from_options = Class.new(ArraySerializer) do
def serializable_object
{ my_content: ['fake'] }
end

View File

@@ -2,7 +2,7 @@ require 'test_helper'
module ActiveModel
class Serializer
class HasOneTest < ActiveModel::TestCase
class HasOneTest < Minitest::Test
def setup
@association = UserSerializer._associations[:profile]
@old_association = @association.dup
@@ -119,7 +119,7 @@ module ActiveModel
def test_associations_embedding_ids_using_a_given_serializer
@association.embed = :ids
@association.embed_in_root = true
@association.serializer_from_options = Class.new(ActiveModel::Serializer) do
@association.serializer_from_options = Class.new(Serializer) do
def name
'fake'
end
@@ -134,7 +134,7 @@ module ActiveModel
end
def test_associations_embedding_objects_using_a_given_serializer
@association.serializer_from_options = Class.new(ActiveModel::Serializer) do
@association.serializer_from_options = Class.new(Serializer) do
def name
'fake'
end

View File

@@ -2,7 +2,7 @@ require 'test_helper'
module ActiveModel
class Serializer
class MetaTest < ActiveModel::TestCase
class MetaTest < Minitest::Test
def setup
@profile = Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' })
end

View File

@@ -2,7 +2,7 @@ require 'test_helper'
module ActiveModel
class Serializer
class RootAsOptionTest < ActiveModel::TestCase
class RootAsOptionTest < Minitest::Test
def setup
@old_root = ProfileSerializer._root
@profile = Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' })
@@ -70,7 +70,7 @@ module ActiveModel
end
end
class RootInSerializerTest < ActiveModel::TestCase
class RootInSerializerTest < Minitest::Test
def setup
@old_root = ProfileSerializer._root
ProfileSerializer._root = :in_serializer

View File

@@ -2,7 +2,7 @@ require 'test_helper'
module ActiveModel
class Serializer
class ScopeTest < ActiveModel::TestCase
class ScopeTest < Minitest::Test
def setup
@serializer = ProfileSerializer.new(nil, scope: current_user)
end
@@ -18,7 +18,7 @@ module ActiveModel
end
end
class NestedScopeTest < ActiveModel::TestCase
class NestedScopeTest < Minitest::Test
def setup
@association = UserSerializer._associations[:profile]
@old_association = @association.dup
@@ -31,7 +31,7 @@ module ActiveModel
end
def test_scope_passed_through
@association.serializer_from_options = Class.new(ActiveModel::Serializer) do
@association.serializer_from_options = Class.new(Serializer) do
def name
scope
end