mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-22 22:06:50 +00:00
Favor ActiveSupport::TestCase over Minitest::Test
- Better minitest 4/5 support - Better DSL - Already available with no changes - Consistent interface
This commit is contained in:
parent
9909908962
commit
419faf03b9
@ -2,7 +2,7 @@ require 'test_helper'
|
|||||||
|
|
||||||
module ActiveModel
|
module ActiveModel
|
||||||
class Serializer
|
class Serializer
|
||||||
class LoggingTest < Minitest::Test
|
class LoggingTest < ActiveSupport::TestCase
|
||||||
class TestLogger < ActiveSupport::Logger
|
class TestLogger < ActiveSupport::Logger
|
||||||
def initialize
|
def initialize
|
||||||
@file = StringIO.new
|
@file = StringIO.new
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class ActiveModelSerializers::ModelTest < Minitest::Test
|
class ActiveModelSerializers::ModelTest < ActiveSupport::TestCase
|
||||||
include ActiveModel::Serializer::Lint::Tests
|
include ActiveModel::Serializer::Lint::Tests
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class ActiveModelSerializers::SerializationContextTest < Minitest::Test
|
class ActiveModelSerializers::SerializationContextTest < ActiveSupport::TestCase
|
||||||
def create_context
|
def create_context
|
||||||
request = Minitest::Mock.new
|
request = Minitest::Mock.new
|
||||||
request.expect(:original_url, 'original_url')
|
request.expect(:original_url, 'original_url')
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class ActiveRecordTest < Minitest::Test
|
class ActiveRecordTest < ActiveSupport::TestCase
|
||||||
include ActiveModel::Serializer::Lint::Tests
|
include ActiveModel::Serializer::Lint::Tests
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
|
|||||||
@ -2,7 +2,7 @@ require 'test_helper'
|
|||||||
module ActiveModel
|
module ActiveModel
|
||||||
class Serializer
|
class Serializer
|
||||||
module Adapter
|
module Adapter
|
||||||
class FragmentCacheTest < Minitest::Test
|
class FragmentCacheTest < ActiveSupport::TestCase
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
@spam = Spam::UnrelatedLink.new(id: 'spam-id-1')
|
@spam = Spam::UnrelatedLink.new(id: 'spam-id-1')
|
||||||
|
|||||||
@ -4,7 +4,7 @@ module ActiveModel
|
|||||||
class Serializer
|
class Serializer
|
||||||
module Adapter
|
module Adapter
|
||||||
class Json
|
class Json
|
||||||
class BelongsToTest < Minitest::Test
|
class BelongsToTest < ActiveSupport::TestCase
|
||||||
def setup
|
def setup
|
||||||
@post = Post.new(id: 42, title: 'New Post', body: 'Body')
|
@post = Post.new(id: 42, title: 'New Post', body: 'Body')
|
||||||
@anonymous_post = Post.new(id: 43, title: 'Hello!!', body: 'Hello, world!!')
|
@anonymous_post = Post.new(id: 43, title: 'Hello!!', body: 'Hello, world!!')
|
||||||
|
|||||||
@ -4,7 +4,7 @@ module ActiveModel
|
|||||||
class Serializer
|
class Serializer
|
||||||
module Adapter
|
module Adapter
|
||||||
class Json
|
class Json
|
||||||
class Collection < Minitest::Test
|
class Collection < ActiveSupport::TestCase
|
||||||
def setup
|
def setup
|
||||||
@author = Author.new(id: 1, name: 'Steve K.')
|
@author = Author.new(id: 1, name: 'Steve K.')
|
||||||
@first_post = Post.new(id: 1, title: 'Hello!!', body: 'Hello, world!!')
|
@first_post = Post.new(id: 1, title: 'Hello!!', body: 'Hello, world!!')
|
||||||
|
|||||||
@ -4,7 +4,7 @@ module ActiveModel
|
|||||||
class Serializer
|
class Serializer
|
||||||
module Adapter
|
module Adapter
|
||||||
class Json
|
class Json
|
||||||
class HasManyTestTest < Minitest::Test
|
class HasManyTestTest < ActiveSupport::TestCase
|
||||||
def setup
|
def setup
|
||||||
ActionController::Base.cache_store.clear
|
ActionController::Base.cache_store.clear
|
||||||
@author = Author.new(id: 1, name: 'Steve K.')
|
@author = Author.new(id: 1, name: 'Steve K.')
|
||||||
|
|||||||
@ -4,7 +4,7 @@ module ActiveModel
|
|||||||
class Serializer
|
class Serializer
|
||||||
module Adapter
|
module Adapter
|
||||||
class JsonApi
|
class JsonApi
|
||||||
class BelongsToTest < Minitest::Test
|
class BelongsToTest < ActiveSupport::TestCase
|
||||||
def setup
|
def setup
|
||||||
@author = Author.new(id: 1, name: 'Steve K.')
|
@author = Author.new(id: 1, name: 'Steve K.')
|
||||||
@author.bio = nil
|
@author.bio = nil
|
||||||
|
|||||||
@ -4,7 +4,7 @@ module ActiveModel
|
|||||||
class Serializer
|
class Serializer
|
||||||
module Adapter
|
module Adapter
|
||||||
class JsonApi
|
class JsonApi
|
||||||
class CollectionTest < Minitest::Test
|
class CollectionTest < ActiveSupport::TestCase
|
||||||
def setup
|
def setup
|
||||||
@author = Author.new(id: 1, name: 'Steve K.')
|
@author = Author.new(id: 1, name: 'Steve K.')
|
||||||
@author.bio = nil
|
@author.bio = nil
|
||||||
|
|||||||
@ -4,7 +4,7 @@ module ActiveModel
|
|||||||
class Serializer
|
class Serializer
|
||||||
module Adapter
|
module Adapter
|
||||||
class JsonApi
|
class JsonApi
|
||||||
class FieldsTest < Minitest::Test
|
class FieldsTest < ActiveSupport::TestCase
|
||||||
Post = Class.new(::Model)
|
Post = Class.new(::Model)
|
||||||
class PostSerializer < ActiveModel::Serializer
|
class PostSerializer < ActiveModel::Serializer
|
||||||
type 'posts'
|
type 'posts'
|
||||||
|
|||||||
@ -4,7 +4,7 @@ module ActiveModel
|
|||||||
class Serializer
|
class Serializer
|
||||||
module Adapter
|
module Adapter
|
||||||
class JsonApi
|
class JsonApi
|
||||||
class HasManyEmbedIdsTest < Minitest::Test
|
class HasManyEmbedIdsTest < ActiveSupport::TestCase
|
||||||
def setup
|
def setup
|
||||||
@author = Author.new(name: 'Steve K.')
|
@author = Author.new(name: 'Steve K.')
|
||||||
@author.bio = nil
|
@author.bio = nil
|
||||||
|
|||||||
@ -5,7 +5,7 @@ module ActiveModel
|
|||||||
module Adapter
|
module Adapter
|
||||||
class JsonApi
|
class JsonApi
|
||||||
# Test 'has_many :assocs, serializer: AssocXSerializer'
|
# Test 'has_many :assocs, serializer: AssocXSerializer'
|
||||||
class HasManyExplicitSerializerTest < Minitest::Test
|
class HasManyExplicitSerializerTest < ActiveSupport::TestCase
|
||||||
def setup
|
def setup
|
||||||
@post = Post.new(title: 'New Post', body: 'Body')
|
@post = Post.new(title: 'New Post', body: 'Body')
|
||||||
@author = Author.new(name: 'Jane Blogger')
|
@author = Author.new(name: 'Jane Blogger')
|
||||||
|
|||||||
@ -4,7 +4,7 @@ module ActiveModel
|
|||||||
class Serializer
|
class Serializer
|
||||||
module Adapter
|
module Adapter
|
||||||
class JsonApi
|
class JsonApi
|
||||||
class HasManyTest < Minitest::Test
|
class HasManyTest < ActiveSupport::TestCase
|
||||||
def setup
|
def setup
|
||||||
ActionController::Base.cache_store.clear
|
ActionController::Base.cache_store.clear
|
||||||
@author = Author.new(id: 1, name: 'Steve K.')
|
@author = Author.new(id: 1, name: 'Steve K.')
|
||||||
|
|||||||
@ -4,7 +4,7 @@ module ActiveModel
|
|||||||
class Serializer
|
class Serializer
|
||||||
module Adapter
|
module Adapter
|
||||||
class JsonApi
|
class JsonApi
|
||||||
class HasOneTest < Minitest::Test
|
class HasOneTest < ActiveSupport::TestCase
|
||||||
def setup
|
def setup
|
||||||
@author = Author.new(id: 1, name: 'Steve K.')
|
@author = Author.new(id: 1, name: 'Steve K.')
|
||||||
@bio = Bio.new(id: 43, content: 'AMS Contributor')
|
@bio = Bio.new(id: 43, content: 'AMS Contributor')
|
||||||
|
|||||||
@ -3,7 +3,7 @@ require 'test_helper'
|
|||||||
module ActiveModel
|
module ActiveModel
|
||||||
class Serializer
|
class Serializer
|
||||||
module Adapter
|
module Adapter
|
||||||
class JsonApiTest < Minitest::Test
|
class JsonApiTest < ActiveSupport::TestCase
|
||||||
def setup
|
def setup
|
||||||
ActionController::Base.cache_store.clear
|
ActionController::Base.cache_store.clear
|
||||||
@author = Author.new(id: 1, name: 'Steve K.')
|
@author = Author.new(id: 1, name: 'Steve K.')
|
||||||
|
|||||||
@ -9,7 +9,7 @@ module ActiveModel
|
|||||||
class Serializer
|
class Serializer
|
||||||
module Adapter
|
module Adapter
|
||||||
class JsonApi
|
class JsonApi
|
||||||
class LinkedTest < Minitest::Test
|
class LinkedTest < ActiveSupport::TestCase
|
||||||
def setup
|
def setup
|
||||||
@author1 = Author.new(id: 1, name: 'Steve K.')
|
@author1 = Author.new(id: 1, name: 'Steve K.')
|
||||||
@author2 = Author.new(id: 2, name: 'Tenderlove')
|
@author2 = Author.new(id: 2, name: 'Tenderlove')
|
||||||
@ -283,7 +283,7 @@ module ActiveModel
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class NoDuplicatesTest < Minitest::Test
|
class NoDuplicatesTest < ActiveSupport::TestCase
|
||||||
Post = Class.new(::Model)
|
Post = Class.new(::Model)
|
||||||
Author = Class.new(::Model)
|
Author = Class.new(::Model)
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@ module ActiveModel
|
|||||||
class Serializer
|
class Serializer
|
||||||
module Adapter
|
module Adapter
|
||||||
class JsonApi
|
class JsonApi
|
||||||
class LinksTest < Minitest::Test
|
class LinksTest < ActiveSupport::TestCase
|
||||||
LinkAuthor = Class.new(::Model)
|
LinkAuthor = Class.new(::Model)
|
||||||
class LinkAuthorSerializer < ActiveModel::Serializer
|
class LinkAuthorSerializer < ActiveModel::Serializer
|
||||||
link :self do
|
link :self do
|
||||||
|
|||||||
@ -8,7 +8,7 @@ module ActiveModel
|
|||||||
class Serializer
|
class Serializer
|
||||||
module Adapter
|
module Adapter
|
||||||
class JsonApi
|
class JsonApi
|
||||||
class PaginationLinksTest < Minitest::Test
|
class PaginationLinksTest < ActiveSupport::TestCase
|
||||||
URI = 'http://example.com'
|
URI = 'http://example.com'
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
|
|||||||
@ -4,7 +4,7 @@ module ActiveModel
|
|||||||
class Serializer
|
class Serializer
|
||||||
module Adapter
|
module Adapter
|
||||||
class JsonApi
|
class JsonApi
|
||||||
class ResourceTypeConfigTest < Minitest::Test
|
class ResourceTypeConfigTest < ActiveSupport::TestCase
|
||||||
class ProfileTypeSerializer < ActiveModel::Serializer
|
class ProfileTypeSerializer < ActiveModel::Serializer
|
||||||
attributes :name
|
attributes :name
|
||||||
type 'profile'
|
type 'profile'
|
||||||
|
|||||||
@ -4,7 +4,7 @@ module ActiveModel
|
|||||||
class Serializer
|
class Serializer
|
||||||
module Adapter
|
module Adapter
|
||||||
class JsonApi
|
class JsonApi
|
||||||
class TopLevelJsonApiTest < Minitest::Test
|
class TopLevelJsonApiTest < ActiveSupport::TestCase
|
||||||
def setup
|
def setup
|
||||||
@author = Author.new(id: 1, name: 'Steve K.')
|
@author = Author.new(id: 1, name: 'Steve K.')
|
||||||
@author.bio = nil
|
@author.bio = nil
|
||||||
|
|||||||
@ -3,7 +3,7 @@ require 'test_helper'
|
|||||||
module ActiveModel
|
module ActiveModel
|
||||||
class Serializer
|
class Serializer
|
||||||
module Adapter
|
module Adapter
|
||||||
class JsonTest < Minitest::Test
|
class JsonTest < ActiveSupport::TestCase
|
||||||
def setup
|
def setup
|
||||||
ActionController::Base.cache_store.clear
|
ActionController::Base.cache_store.clear
|
||||||
@author = Author.new(id: 1, name: 'Steve K.')
|
@author = Author.new(id: 1, name: 'Steve K.')
|
||||||
|
|||||||
@ -3,7 +3,7 @@ require 'test_helper'
|
|||||||
module ActiveModel
|
module ActiveModel
|
||||||
class Serializer
|
class Serializer
|
||||||
module Adapter
|
module Adapter
|
||||||
class NullTest < Minitest::Test
|
class NullTest < ActiveSupport::TestCase
|
||||||
def setup
|
def setup
|
||||||
profile = Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' })
|
profile = Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' })
|
||||||
serializer = ProfileSerializer.new(profile)
|
serializer = ProfileSerializer.new(profile)
|
||||||
|
|||||||
@ -2,7 +2,7 @@ require 'test_helper'
|
|||||||
|
|
||||||
module ActiveModel
|
module ActiveModel
|
||||||
class Serializer
|
class Serializer
|
||||||
class AdapterTest < Minitest::Test
|
class AdapterTest < ActiveSupport::TestCase
|
||||||
def setup
|
def setup
|
||||||
profile = Profile.new
|
profile = Profile.new
|
||||||
@serializer = ProfileSerializer.new(profile)
|
@serializer = ProfileSerializer.new(profile)
|
||||||
|
|||||||
@ -21,7 +21,7 @@ module ActiveModel
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
class ArraySerializerTest < Minitest::Test
|
class ArraySerializerTest < ActiveSupport::TestCase
|
||||||
extend ActiveSupport::Testing::Stream
|
extend ActiveSupport::Testing::Stream
|
||||||
def test_json_key_with_root_warns_when_using_array_serializer
|
def test_json_key_with_root_warns_when_using_array_serializer
|
||||||
stderr = (capture(:stderr) do
|
stderr = (capture(:stderr) do
|
||||||
|
|||||||
@ -2,7 +2,7 @@ require 'test_helper'
|
|||||||
|
|
||||||
module ActiveModel
|
module ActiveModel
|
||||||
class Serializer
|
class Serializer
|
||||||
class CollectionSerializerTest < Minitest::Test
|
class CollectionSerializerTest < ActiveSupport::TestCase
|
||||||
def setup
|
def setup
|
||||||
@comment = Comment.new
|
@comment = Comment.new
|
||||||
@post = Post.new
|
@post = Post.new
|
||||||
|
|||||||
@ -2,7 +2,7 @@ require 'test_helper'
|
|||||||
require 'grape'
|
require 'grape'
|
||||||
require 'grape/active_model_serializers'
|
require 'grape/active_model_serializers'
|
||||||
|
|
||||||
class ActiveModelSerializers::GrapeTest < Minitest::Test
|
class ActiveModelSerializers::GrapeTest < ActiveSupport::TestCase
|
||||||
include Rack::Test::Methods
|
include Rack::Test::Methods
|
||||||
module Models
|
module Models
|
||||||
def self.model1
|
def self.model1
|
||||||
|
|||||||
@ -3,7 +3,7 @@ require 'test_helper'
|
|||||||
module ActiveModel
|
module ActiveModel
|
||||||
class Serializer
|
class Serializer
|
||||||
class IncludeTree
|
class IncludeTree
|
||||||
class FromStringTest < Minitest::Test
|
class FromStringTest < ActiveSupport::TestCase
|
||||||
def test_simple_array
|
def test_simple_array
|
||||||
input = [:comments, :author]
|
input = [:comments, :author]
|
||||||
actual = ActiveModel::Serializer::IncludeTree.from_include_args(input)
|
actual = ActiveModel::Serializer::IncludeTree.from_include_args(input)
|
||||||
|
|||||||
@ -3,7 +3,7 @@ require 'test_helper'
|
|||||||
module ActiveModel
|
module ActiveModel
|
||||||
class Serializer
|
class Serializer
|
||||||
class IncludeTree
|
class IncludeTree
|
||||||
class FromStringTest < Minitest::Test
|
class FromStringTest < ActiveSupport::TestCase
|
||||||
def test_single_string
|
def test_single_string
|
||||||
input = 'author'
|
input = 'author'
|
||||||
actual = ActiveModel::Serializer::IncludeTree.from_string(input)
|
actual = ActiveModel::Serializer::IncludeTree.from_string(input)
|
||||||
|
|||||||
@ -2,7 +2,7 @@ require 'test_helper'
|
|||||||
|
|
||||||
module ActiveModel
|
module ActiveModel
|
||||||
class Serializer
|
class Serializer
|
||||||
class LintTest < Minitest::Test
|
class LintTest < ActiveSupport::TestCase
|
||||||
include ActiveModel::Serializer::Lint::Tests
|
include ActiveModel::Serializer::Lint::Tests
|
||||||
|
|
||||||
class CompliantResource
|
class CompliantResource
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class ActiveModelSerializers::LoggerTest < Minitest::Test
|
class ActiveModelSerializers::LoggerTest < ActiveSupport::TestCase
|
||||||
def test_logger_is_set_to_action_controller_logger_when_initializer_runs
|
def test_logger_is_set_to_action_controller_logger_when_initializer_runs
|
||||||
assert_equal $action_controller_logger, ActionController::Base.logger # rubocop:disable Style/GlobalVars
|
assert_equal $action_controller_logger, ActionController::Base.logger # rubocop:disable Style/GlobalVars
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class PoroTest < Minitest::Test
|
class PoroTest < ActiveSupport::TestCase
|
||||||
include ActiveModel::Serializer::Lint::Tests
|
include ActiveModel::Serializer::Lint::Tests
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
module ActiveModel
|
module ActiveModel
|
||||||
class SerializableResourceTest < Minitest::Test
|
class SerializableResourceTest < ActiveSupport::TestCase
|
||||||
def setup
|
def setup
|
||||||
@resource = Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' })
|
@resource = Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' })
|
||||||
@serializer = ProfileSerializer.new(@resource)
|
@serializer = ProfileSerializer.new(@resource)
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
module ActiveModel
|
module ActiveModel
|
||||||
class Serializer
|
class Serializer
|
||||||
class AdapterForTest < Minitest::Test
|
class AdapterForTest < ActiveSupport::TestCase
|
||||||
UnknownAdapterError = ::ActiveModel::Serializer::Adapter::UnknownAdapterError
|
UnknownAdapterError = ::ActiveModel::Serializer::Adapter::UnknownAdapterError
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
|
|||||||
@ -2,7 +2,7 @@ require 'test_helper'
|
|||||||
|
|
||||||
module ActiveModel
|
module ActiveModel
|
||||||
class Serializer
|
class Serializer
|
||||||
class AssociationMacrosTest < Minitest::Test
|
class AssociationMacrosTest < ActiveSupport::TestCase
|
||||||
AuthorSummarySerializer = Class.new
|
AuthorSummarySerializer = Class.new
|
||||||
class AssociationsTestSerializer < Serializer
|
class AssociationsTestSerializer < Serializer
|
||||||
belongs_to :author, serializer: AuthorSummarySerializer
|
belongs_to :author, serializer: AuthorSummarySerializer
|
||||||
|
|||||||
@ -2,7 +2,7 @@ require 'test_helper'
|
|||||||
|
|
||||||
module ActiveModel
|
module ActiveModel
|
||||||
class Serializer
|
class Serializer
|
||||||
class AssociationsTest < Minitest::Test
|
class AssociationsTest < ActiveSupport::TestCase
|
||||||
def setup
|
def setup
|
||||||
@author = Author.new(name: 'Steve K.')
|
@author = Author.new(name: 'Steve K.')
|
||||||
@author.bio = nil
|
@author.bio = nil
|
||||||
@ -158,7 +158,7 @@ module ActiveModel
|
|||||||
::ARModels::Comment.delete_all
|
::ARModels::Comment.delete_all
|
||||||
end
|
end
|
||||||
|
|
||||||
class NamespacedResourcesTest < Minitest::Test
|
class NamespacedResourcesTest < ActiveSupport::TestCase
|
||||||
class ResourceNamespace
|
class ResourceNamespace
|
||||||
Post = Class.new(::Model)
|
Post = Class.new(::Model)
|
||||||
Comment = Class.new(::Model)
|
Comment = Class.new(::Model)
|
||||||
@ -200,7 +200,7 @@ module ActiveModel
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class NestedSerializersTest < Minitest::Test
|
class NestedSerializersTest < ActiveSupport::TestCase
|
||||||
Post = Class.new(::Model)
|
Post = Class.new(::Model)
|
||||||
Comment = Class.new(::Model)
|
Comment = Class.new(::Model)
|
||||||
Author = Class.new(::Model)
|
Author = Class.new(::Model)
|
||||||
|
|||||||
@ -2,7 +2,7 @@ require 'test_helper'
|
|||||||
|
|
||||||
module ActiveModel
|
module ActiveModel
|
||||||
class Serializer
|
class Serializer
|
||||||
class AttributeTest < Minitest::Test
|
class AttributeTest < ActiveSupport::TestCase
|
||||||
def setup
|
def setup
|
||||||
@blog = Blog.new({ id: 1, name: 'AMS Hints', type: 'stuff' })
|
@blog = Blog.new({ id: 1, name: 'AMS Hints', type: 'stuff' })
|
||||||
@blog_serializer = AlternateBlogSerializer.new(@blog)
|
@blog_serializer = AlternateBlogSerializer.new(@blog)
|
||||||
|
|||||||
@ -2,7 +2,7 @@ require 'test_helper'
|
|||||||
|
|
||||||
module ActiveModel
|
module ActiveModel
|
||||||
class Serializer
|
class Serializer
|
||||||
class AttributesTest < Minitest::Test
|
class AttributesTest < ActiveSupport::TestCase
|
||||||
def setup
|
def setup
|
||||||
@profile = Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' })
|
@profile = Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' })
|
||||||
@profile_serializer = ProfileSerializer.new(@profile)
|
@profile_serializer = ProfileSerializer.new(@profile)
|
||||||
|
|||||||
@ -3,7 +3,7 @@ require 'tmpdir'
|
|||||||
require 'tempfile'
|
require 'tempfile'
|
||||||
module ActiveModel
|
module ActiveModel
|
||||||
class Serializer
|
class Serializer
|
||||||
class CacheTest < Minitest::Test
|
class CacheTest < ActiveSupport::TestCase
|
||||||
include ActiveSupport::Testing::Stream
|
include ActiveSupport::Testing::Stream
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
|
|||||||
@ -2,7 +2,7 @@ require 'test_helper'
|
|||||||
|
|
||||||
module ActiveModel
|
module ActiveModel
|
||||||
class Serializer
|
class Serializer
|
||||||
class ConfigurationTest < Minitest::Test
|
class ConfigurationTest < ActiveSupport::TestCase
|
||||||
def test_collection_serializer
|
def test_collection_serializer
|
||||||
assert_equal ActiveModel::Serializer::CollectionSerializer, ActiveModelSerializers.config.collection_serializer
|
assert_equal ActiveModel::Serializer::CollectionSerializer, ActiveModelSerializers.config.collection_serializer
|
||||||
end
|
end
|
||||||
|
|||||||
@ -2,7 +2,7 @@ require 'test_helper'
|
|||||||
|
|
||||||
module ActiveModel
|
module ActiveModel
|
||||||
class Serializer
|
class Serializer
|
||||||
class FieldsetTest < Minitest::Test
|
class FieldsetTest < ActiveSupport::TestCase
|
||||||
def test_fieldset_with_hash
|
def test_fieldset_with_hash
|
||||||
fieldset = ActiveModel::Serializer::Fieldset.new('post' => %w(id title), 'comment' => ['body'])
|
fieldset = ActiveModel::Serializer::Fieldset.new('post' => %w(id title), 'comment' => ['body'])
|
||||||
expected = { :post => [:id, :title], :comment => [:body] }
|
expected = { :post => [:id, :title], :comment => [:body] }
|
||||||
|
|||||||
@ -2,7 +2,7 @@ require 'test_helper'
|
|||||||
|
|
||||||
module ActiveModel
|
module ActiveModel
|
||||||
class Serializer
|
class Serializer
|
||||||
class MetaTest < Minitest::Test
|
class MetaTest < ActiveSupport::TestCase
|
||||||
def setup
|
def setup
|
||||||
@blog = Blog.new(id: 1,
|
@blog = Blog.new(id: 1,
|
||||||
name: 'AMS Hints',
|
name: 'AMS Hints',
|
||||||
|
|||||||
@ -2,7 +2,7 @@ require 'test_helper'
|
|||||||
|
|
||||||
module ActiveModel
|
module ActiveModel
|
||||||
class Serializer
|
class Serializer
|
||||||
class OptionsTest < Minitest::Test
|
class OptionsTest < ActiveSupport::TestCase
|
||||||
def setup
|
def setup
|
||||||
@profile = Profile.new(name: 'Name 1', description: 'Description 1')
|
@profile = Profile.new(name: 'Name 1', description: 'Description 1')
|
||||||
end
|
end
|
||||||
|
|||||||
@ -2,7 +2,7 @@ require 'test_helper'
|
|||||||
|
|
||||||
module ActiveModel
|
module ActiveModel
|
||||||
class Serializer
|
class Serializer
|
||||||
class RootTest < Minitest::Test
|
class RootTest < ActiveSupport::TestCase
|
||||||
def setup
|
def setup
|
||||||
@virtual_value = VirtualValue.new(id: 1)
|
@virtual_value = VirtualValue.new(id: 1)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -2,8 +2,8 @@ require 'test_helper'
|
|||||||
|
|
||||||
module ActiveModel
|
module ActiveModel
|
||||||
class Serializer
|
class Serializer
|
||||||
class SerializerForTest < Minitest::Test
|
class SerializerForTest < ActiveSupport::TestCase
|
||||||
class CollectionSerializerTest < Minitest::Test
|
class CollectionSerializerTest < ActiveSupport::TestCase
|
||||||
def setup
|
def setup
|
||||||
@array = [1, 2, 3]
|
@array = [1, 2, 3]
|
||||||
@previous_collection_serializer = ActiveModelSerializers.config.collection_serializer
|
@previous_collection_serializer = ActiveModelSerializers.config.collection_serializer
|
||||||
@ -26,7 +26,7 @@ module ActiveModel
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class SerializerTest < Minitest::Test
|
class SerializerTest < ActiveSupport::TestCase
|
||||||
module ResourceNamespace
|
module ResourceNamespace
|
||||||
Post = Class.new(::Model)
|
Post = Class.new(::Model)
|
||||||
Comment = Class.new(::Model)
|
Comment = Class.new(::Model)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user