active_model_serializers 0.8.3 → 0.10.0.rc4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (184) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +6 -0
  3. data/.rubocop.yml +86 -0
  4. data/.rubocop_todo.yml +240 -0
  5. data/.simplecov +111 -0
  6. data/.travis.yml +33 -22
  7. data/CHANGELOG.md +358 -6
  8. data/CONTRIBUTING.md +220 -0
  9. data/Gemfile +46 -1
  10. data/{MIT-LICENSE.txt → LICENSE.txt} +3 -2
  11. data/README.md +81 -591
  12. data/Rakefile +68 -11
  13. data/active_model_serializers.gemspec +57 -23
  14. data/appveyor.yml +27 -0
  15. data/docs/ARCHITECTURE.md +120 -0
  16. data/docs/DESIGN.textile +8 -0
  17. data/docs/README.md +35 -0
  18. data/docs/general/adapters.md +162 -0
  19. data/docs/general/caching.md +52 -0
  20. data/docs/general/configuration_options.md +27 -0
  21. data/docs/general/getting_started.md +98 -0
  22. data/docs/general/instrumentation.md +40 -0
  23. data/docs/general/logging.md +14 -0
  24. data/docs/general/rendering.md +153 -0
  25. data/docs/general/serializers.md +207 -0
  26. data/docs/how-open-source-maintained.jpg +0 -0
  27. data/docs/howto/add_pagination_links.md +121 -0
  28. data/docs/howto/add_root_key.md +51 -0
  29. data/docs/howto/outside_controller_use.md +58 -0
  30. data/docs/howto/test.md +152 -0
  31. data/docs/integrations/ember-and-json-api.md +112 -0
  32. data/docs/integrations/grape.md +19 -0
  33. data/docs/jsonapi/schema/schema.json +366 -0
  34. data/docs/jsonapi/schema.md +140 -0
  35. data/lib/action_controller/serialization.rb +41 -37
  36. data/lib/active_model/serializable_resource.rb +72 -0
  37. data/lib/active_model/serializer/adapter/attributes.rb +66 -0
  38. data/lib/active_model/serializer/adapter/base.rb +58 -0
  39. data/lib/active_model/serializer/adapter/cached_serializer.rb +45 -0
  40. data/lib/active_model/serializer/adapter/fragment_cache.rb +111 -0
  41. data/lib/active_model/serializer/adapter/json/fragment_cache.rb +13 -0
  42. data/lib/active_model/serializer/adapter/json.rb +21 -0
  43. data/lib/active_model/serializer/adapter/json_api/deserialization.rb +207 -0
  44. data/lib/active_model/serializer/adapter/json_api/fragment_cache.rb +21 -0
  45. data/lib/active_model/serializer/adapter/json_api/link.rb +44 -0
  46. data/lib/active_model/serializer/adapter/json_api/pagination_links.rb +58 -0
  47. data/lib/active_model/serializer/adapter/json_api.rb +223 -0
  48. data/lib/active_model/serializer/adapter/null.rb +11 -0
  49. data/lib/active_model/serializer/adapter.rb +91 -0
  50. data/lib/active_model/serializer/array_serializer.rb +9 -0
  51. data/lib/active_model/serializer/association.rb +20 -0
  52. data/lib/active_model/serializer/associations.rb +87 -220
  53. data/lib/active_model/serializer/attribute.rb +25 -0
  54. data/lib/active_model/serializer/attributes.rb +82 -0
  55. data/lib/active_model/serializer/belongs_to_reflection.rb +10 -0
  56. data/lib/active_model/serializer/caching.rb +100 -0
  57. data/lib/active_model/serializer/collection_reflection.rb +7 -0
  58. data/lib/active_model/serializer/collection_serializer.rb +47 -0
  59. data/lib/active_model/serializer/configuration.rb +28 -0
  60. data/lib/active_model/serializer/field.rb +56 -0
  61. data/lib/active_model/serializer/fieldset.rb +31 -0
  62. data/lib/active_model/serializer/has_many_reflection.rb +10 -0
  63. data/lib/active_model/serializer/has_one_reflection.rb +10 -0
  64. data/lib/active_model/serializer/include_tree.rb +111 -0
  65. data/lib/active_model/serializer/links.rb +33 -0
  66. data/lib/active_model/serializer/lint.rb +142 -0
  67. data/lib/active_model/serializer/reflection.rb +91 -0
  68. data/lib/active_model/serializer/singular_reflection.rb +7 -0
  69. data/lib/active_model/serializer/type.rb +25 -0
  70. data/lib/active_model/{serializers → serializer}/version.rb +1 -1
  71. data/lib/active_model/serializer.rb +99 -479
  72. data/lib/active_model_serializers/callbacks.rb +55 -0
  73. data/lib/active_model_serializers/deserialization.rb +13 -0
  74. data/lib/active_model_serializers/logging.rb +119 -0
  75. data/lib/active_model_serializers/model.rb +39 -0
  76. data/lib/active_model_serializers/railtie.rb +38 -0
  77. data/lib/active_model_serializers/serialization_context.rb +10 -0
  78. data/lib/active_model_serializers/test/schema.rb +103 -0
  79. data/lib/active_model_serializers/test/serializer.rb +125 -0
  80. data/lib/active_model_serializers/test.rb +7 -0
  81. data/lib/active_model_serializers.rb +20 -92
  82. data/lib/generators/rails/USAGE +6 -0
  83. data/lib/generators/rails/resource_override.rb +10 -0
  84. data/lib/generators/rails/serializer_generator.rb +36 -0
  85. data/lib/generators/rails/templates/serializer.rb.erb +8 -0
  86. data/lib/grape/active_model_serializers.rb +14 -0
  87. data/lib/grape/formatters/active_model_serializers.rb +15 -0
  88. data/lib/grape/helpers/active_model_serializers.rb +16 -0
  89. data/test/action_controller/adapter_selector_test.rb +53 -0
  90. data/test/action_controller/explicit_serializer_test.rb +134 -0
  91. data/test/action_controller/json/include_test.rb +167 -0
  92. data/test/action_controller/json_api/deserialization_test.rb +59 -0
  93. data/test/action_controller/json_api/linked_test.rb +196 -0
  94. data/test/action_controller/json_api/pagination_test.rb +116 -0
  95. data/test/{serialization_scope_name_test.rb → action_controller/serialization_scope_name_test.rb} +11 -15
  96. data/test/action_controller/serialization_test.rb +435 -0
  97. data/test/active_model_serializers/logging_test.rb +77 -0
  98. data/test/active_model_serializers/model_test.rb +9 -0
  99. data/test/active_model_serializers/railtie_test_isolated.rb +57 -0
  100. data/test/active_model_serializers/serialization_context_test.rb +18 -0
  101. data/test/active_model_serializers/test/schema_test.rb +128 -0
  102. data/test/active_model_serializers/test/serializer_test.rb +63 -0
  103. data/test/active_record_test.rb +9 -0
  104. data/test/adapter/fragment_cache_test.rb +38 -0
  105. data/test/adapter/json/belongs_to_test.rb +47 -0
  106. data/test/adapter/json/collection_test.rb +92 -0
  107. data/test/adapter/json/has_many_test.rb +47 -0
  108. data/test/adapter/json_api/belongs_to_test.rb +157 -0
  109. data/test/adapter/json_api/collection_test.rb +97 -0
  110. data/test/adapter/json_api/fields_test.rb +89 -0
  111. data/test/adapter/json_api/has_many_embed_ids_test.rb +45 -0
  112. data/test/adapter/json_api/has_many_explicit_serializer_test.rb +98 -0
  113. data/test/adapter/json_api/has_many_test.rb +145 -0
  114. data/test/adapter/json_api/has_one_test.rb +81 -0
  115. data/test/adapter/json_api/json_api_test.rb +37 -0
  116. data/test/adapter/json_api/linked_test.rb +394 -0
  117. data/test/adapter/json_api/links_test.rb +68 -0
  118. data/test/adapter/json_api/pagination_links_test.rb +115 -0
  119. data/test/adapter/json_api/parse_test.rb +139 -0
  120. data/test/adapter/json_api/resource_type_config_test.rb +71 -0
  121. data/test/adapter/json_api/toplevel_jsonapi_test.rb +84 -0
  122. data/test/adapter/json_test.rb +47 -0
  123. data/test/adapter/null_test.rb +25 -0
  124. data/test/adapter_test.rb +42 -0
  125. data/test/array_serializer_test.rb +36 -73
  126. data/test/collection_serializer_test.rb +100 -0
  127. data/test/fixtures/active_record.rb +56 -0
  128. data/test/fixtures/poro.rb +229 -0
  129. data/test/generators/scaffold_controller_generator_test.rb +24 -0
  130. data/test/generators/serializer_generator_test.rb +57 -0
  131. data/test/grape_test.rb +82 -0
  132. data/test/include_tree/from_include_args_test.rb +26 -0
  133. data/test/include_tree/from_string_test.rb +94 -0
  134. data/test/include_tree/include_args_to_hash_test.rb +64 -0
  135. data/test/lint_test.rb +40 -0
  136. data/test/logger_test.rb +18 -0
  137. data/test/poro_test.rb +9 -0
  138. data/test/serializable_resource_test.rb +27 -0
  139. data/test/serializers/adapter_for_test.rb +166 -0
  140. data/test/serializers/association_macros_test.rb +36 -0
  141. data/test/serializers/associations_test.rb +267 -0
  142. data/test/serializers/attribute_test.rb +123 -0
  143. data/test/serializers/attributes_test.rb +52 -0
  144. data/test/serializers/cache_test.rb +209 -0
  145. data/test/serializers/configuration_test.rb +32 -0
  146. data/test/serializers/fieldset_test.rb +14 -0
  147. data/test/serializers/meta_test.rb +130 -0
  148. data/test/serializers/options_test.rb +21 -0
  149. data/test/serializers/root_test.rb +21 -0
  150. data/test/serializers/serializer_for_test.rb +134 -0
  151. data/test/support/custom_schemas/active_model_serializers/test/schema_test/my/index.json +6 -0
  152. data/test/support/isolated_unit.rb +77 -0
  153. data/test/support/rails5_shims.rb +29 -0
  154. data/test/support/rails_app.rb +25 -0
  155. data/test/support/schemas/active_model_serializers/test/schema_test/my/index.json +6 -0
  156. data/test/support/schemas/active_model_serializers/test/schema_test/my/show.json +6 -0
  157. data/test/support/schemas/custom/show.json +7 -0
  158. data/test/support/schemas/hyper_schema.json +93 -0
  159. data/test/support/schemas/render_using_json_api.json +43 -0
  160. data/test/support/schemas/simple_json_pointers.json +10 -0
  161. data/test/support/serialization_testing.rb +53 -0
  162. data/test/support/simplecov.rb +6 -0
  163. data/test/support/stream_capture.rb +50 -0
  164. data/test/support/test_case.rb +19 -0
  165. data/test/test_helper.rb +55 -24
  166. metadata +358 -42
  167. data/DESIGN.textile +0 -586
  168. data/Gemfile.edge +0 -9
  169. data/bench/perf.rb +0 -43
  170. data/cruft.md +0 -19
  171. data/lib/active_model/array_serializer.rb +0 -104
  172. data/lib/active_record/serializer_override.rb +0 -16
  173. data/lib/generators/resource_override.rb +0 -13
  174. data/lib/generators/serializer/USAGE +0 -9
  175. data/lib/generators/serializer/serializer_generator.rb +0 -42
  176. data/lib/generators/serializer/templates/serializer.rb +0 -19
  177. data/test/association_test.rb +0 -592
  178. data/test/caching_test.rb +0 -96
  179. data/test/generators_test.rb +0 -85
  180. data/test/no_serialization_scope_test.rb +0 -34
  181. data/test/serialization_test.rb +0 -392
  182. data/test/serializer_support_test.rb +0 -51
  183. data/test/serializer_test.rb +0 -1465
  184. data/test/test_fakes.rb +0 -217
@@ -0,0 +1,25 @@
1
+ class ActiveModelSerializers::RailsApplication < Rails::Application
2
+ if Rails::VERSION::MAJOR >= 4
3
+ config.eager_load = false
4
+
5
+ config.secret_key_base = 'abc123'
6
+
7
+ config.active_support.test_order = :random
8
+
9
+ config.logger = Logger.new(nil)
10
+
11
+ config.action_controller.perform_caching = true
12
+ ActionController::Base.cache_store = :memory_store
13
+ end
14
+ end
15
+ ActiveModelSerializers::RailsApplication.initialize!
16
+
17
+ module TestHelper
18
+ Routes = ActionDispatch::Routing::RouteSet.new
19
+ Routes.draw do
20
+ get ':controller(/:action(/:id))'
21
+ get ':controller(/:action)'
22
+ end
23
+
24
+ ActionController::Base.send :include, Routes.url_helpers
25
+ end
@@ -0,0 +1,6 @@
1
+ {
2
+ "properties": {
3
+ "name" : { "type" : "string" },
4
+ "description" : { "type" : "string" }
5
+ }
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "properties": {
3
+ "name" : { "type" : "integer" },
4
+ "description" : { "type" : "boolean" }
5
+ }
6
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "id": "file://custom/show.json#",
3
+ "properties": {
4
+ "name" : { "type" : "string" },
5
+ "description" : { "type" : "string" }
6
+ }
7
+ }
@@ -0,0 +1,93 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/hyper-schema",
3
+ "title": "Profile",
4
+ "description": "Profile schema",
5
+ "stability": "prototype",
6
+ "strictProperties": true,
7
+ "type": [
8
+ "object"
9
+ ],
10
+ "definitions": {
11
+ "name": {
12
+ "description": "unique name of profile",
13
+ "readOnly": true,
14
+ "type": [
15
+ "string"
16
+ ]
17
+ },
18
+ "description": {
19
+ "description": "description of profile",
20
+ "readOnly": true,
21
+ "type": [
22
+ "string"
23
+ ]
24
+ },
25
+ "identity": {
26
+ "anyOf": [
27
+ {
28
+ "$ref": "/schemata/profile#/definitions/name"
29
+ }
30
+ ]
31
+ }
32
+ },
33
+ "links": [
34
+ {
35
+ "description": "Create a new profile.",
36
+ "href": "/profiles",
37
+ "method": "POST",
38
+ "rel": "create",
39
+ "schema": {
40
+ "properties": {
41
+ },
42
+ "type": [
43
+ "object"
44
+ ]
45
+ },
46
+ "title": "Create"
47
+ },
48
+ {
49
+ "description": "Delete an existing profile.",
50
+ "href": "/profiles/{(%2Fschemata%2Fprofile%23%2Fdefinitions%2Fidentity)}",
51
+ "method": "DELETE",
52
+ "rel": "destroy",
53
+ "title": "Delete"
54
+ },
55
+ {
56
+ "description": "Info for existing profile.",
57
+ "href": "/profiles/{(%2Fschemata%2Fprofile%23%2Fdefinitions%2Fidentity)}",
58
+ "method": "GET",
59
+ "rel": "self",
60
+ "title": "Info"
61
+ },
62
+ {
63
+ "description": "List existing profiles.",
64
+ "href": "/profiles",
65
+ "method": "GET",
66
+ "rel": "instances",
67
+ "title": "List"
68
+ },
69
+ {
70
+ "description": "Update an existing profile.",
71
+ "href": "/profiles/{(%2Fschemata%2Fprofile%23%2Fdefinitions%2Fidentity)}",
72
+ "method": "PATCH",
73
+ "rel": "update",
74
+ "schema": {
75
+ "properties": {
76
+ },
77
+ "type": [
78
+ "object"
79
+ ]
80
+ },
81
+ "title": "Update"
82
+ }
83
+ ],
84
+ "properties": {
85
+ "name": {
86
+ "$ref": "/schemata/profile#/definitions/name"
87
+ },
88
+ "description": {
89
+ "$ref": "/schemata/profile#/definitions/description"
90
+ }
91
+ },
92
+ "id": "/schemata/profile"
93
+ }
@@ -0,0 +1,43 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "id": "",
4
+ "type": "object",
5
+ "properties": {
6
+ "data": {
7
+ "id": "/data",
8
+ "type": "object",
9
+ "properties": {
10
+ "id": {
11
+ "id": "/data/id",
12
+ "type": "string"
13
+ },
14
+ "type": {
15
+ "id": "/data/type",
16
+ "type": "string"
17
+ },
18
+ "attributes": {
19
+ "id": "/data/attributes",
20
+ "type": "object",
21
+ "properties": {
22
+ "name": {
23
+ "id": "/data/attributes/name",
24
+ "type": "string"
25
+ },
26
+ "description": {
27
+ "id": "/data/attributes/description",
28
+ "type": "string"
29
+ }
30
+ }
31
+ }
32
+ },
33
+ "required": [
34
+ "id",
35
+ "type",
36
+ "attributes"
37
+ ]
38
+ }
39
+ },
40
+ "required": [
41
+ "data"
42
+ ]
43
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "properties": {
3
+ "name": {
4
+ "$ref": "file://custom/show.json#/properties/name"
5
+ },
6
+ "description": {
7
+ "$ref": "file://custom/show.json#/properties/description"
8
+ }
9
+ }
10
+ }
@@ -0,0 +1,53 @@
1
+ module SerializationTesting
2
+ def config
3
+ ActiveModelSerializers.config
4
+ end
5
+
6
+ private
7
+
8
+ def generate_cached_serializer(obj)
9
+ ActiveModel::SerializableResource.new(obj).to_json
10
+ end
11
+
12
+ # Aliased as :with_configured_adapter to clarify that
13
+ # this method tests the configured adapter.
14
+ # When not testing configuration, it may be preferable
15
+ # to pass in the +adapter+ option to <tt>ActiveModel::SerializableResource</tt>.
16
+ # e.g ActiveModel::SerializableResource.new(resource, adapter: :json_api)
17
+ def with_adapter(adapter)
18
+ old_adapter = ActiveModelSerializers.config.adapter
19
+ ActiveModelSerializers.config.adapter = adapter
20
+ yield
21
+ ensure
22
+ ActiveModelSerializers.config.adapter = old_adapter
23
+ end
24
+ alias_method :with_configured_adapter, :with_adapter
25
+
26
+ def with_config(hash)
27
+ old_config = config.dup
28
+ ActiveModelSerializers.config.update(hash)
29
+ yield
30
+ ensure
31
+ ActiveModelSerializers.config.replace(old_config)
32
+ end
33
+
34
+ def with_serializer_lookup_disabled
35
+ original_serializer_lookup = ActiveModelSerializers.config.serializer_lookup_enabled
36
+ ActiveModelSerializers.config.serializer_lookup_enabled = false
37
+ yield
38
+ ensure
39
+ ActiveModelSerializers.config.serializer_lookup_enabled = original_serializer_lookup
40
+ end
41
+
42
+ def serializable(resource, options = {})
43
+ ActiveModel::SerializableResource.new(resource, options)
44
+ end
45
+ end
46
+
47
+ class Minitest::Test
48
+ def before_setup
49
+ ActionController::Base.cache_store.clear
50
+ end
51
+
52
+ include SerializationTesting
53
+ end
@@ -0,0 +1,6 @@
1
+ # https://github.com/colszowka/simplecov/pull/400
2
+ # https://github.com/ruby/ruby/blob/trunk/lib/English.rb
3
+ unless defined?(English)
4
+ # The exception object passed to +raise+.
5
+ alias $ERROR_INFO $! # rubocop:disable Style/SpecialGlobalVars
6
+ end
@@ -0,0 +1,50 @@
1
+ # Use cleaner stream testing interface from Rails 5 if available
2
+ # see https://github.com/rails/rails/blob/29959eb59d/activesupport/lib/active_support/testing/stream.rb
3
+ begin
4
+ require 'active_support/testing/stream'
5
+ rescue LoadError
6
+ require 'tempfile'
7
+ module ActiveSupport
8
+ module Testing
9
+ module Stream #:nodoc:
10
+ private
11
+
12
+ def silence_stream(stream)
13
+ old_stream = stream.dup
14
+ stream.reopen(IO::NULL)
15
+ stream.sync = true
16
+ yield
17
+ ensure
18
+ stream.reopen(old_stream)
19
+ old_stream.close
20
+ end
21
+
22
+ def quietly
23
+ silence_stream(STDOUT) do
24
+ silence_stream(STDERR) do
25
+ yield
26
+ end
27
+ end
28
+ end
29
+
30
+ def capture(stream)
31
+ stream = stream.to_s
32
+ captured_stream = Tempfile.new(stream)
33
+ stream_io = eval("$#{stream}") # rubocop:disable Lint/Eval
34
+ origin_stream = stream_io.dup
35
+ stream_io.reopen(captured_stream)
36
+
37
+ yield
38
+
39
+ stream_io.rewind
40
+ return captured_stream.read
41
+ ensure
42
+ captured_stream.close
43
+ captured_stream.unlink
44
+ stream_io.reopen(origin_stream)
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+
@@ -0,0 +1,19 @@
1
+ ActionController::TestCase.class_eval do
2
+ def setup
3
+ @routes = TestHelper::Routes
4
+ end
5
+
6
+ # For Rails5
7
+ # https://github.com/rails/rails/commit/ca83436d1b3b6cedd1eca2259f65661e69b01909#diff-b9bbf56e85d3fe1999f16317f2751e76L17
8
+ def assigns(key = nil)
9
+ assigns = {}.with_indifferent_access
10
+ @controller.view_assigns.each { |k, v| assigns.regular_writer(k, v) }
11
+ key.nil? ? assigns : assigns[key]
12
+ end
13
+
14
+ # Rails5: Uncomment for debugging where the warnings come from
15
+ # def non_kwarg_request_warning
16
+ # super
17
+ # STDOUT.puts caller[2..3]
18
+ # end
19
+ end
data/test/test_helper.rb CHANGED
@@ -1,32 +1,63 @@
1
- require "rubygems"
2
- require "bundler/setup"
1
+ require 'bundler/setup'
3
2
 
4
- require "pry"
5
-
6
- require "active_model_serializers"
7
- require "active_support/json"
8
- require "minitest/autorun"
3
+ begin
4
+ require 'simplecov'
5
+ # HACK: till https://github.com/colszowka/simplecov/pull/400 is merged and released.
6
+ # Otherwise you may get:
7
+ # simplecov-0.10.0/lib/simplecov/defaults.rb:50: warning: global variable `$ERROR_INFO' not initialized
8
+ require 'support/simplecov'
9
+ AppCoverage.start
10
+ rescue LoadError
11
+ STDERR.puts 'Running without SimpleCov'
12
+ end
9
13
 
14
+ require 'timecop'
10
15
  require 'rails'
16
+ require 'action_controller'
17
+ require 'action_controller/test_case'
18
+ require 'action_controller/railtie'
19
+ require 'active_support/json'
20
+ require 'active_model_serializers'
21
+ require 'fileutils'
22
+ FileUtils.mkdir_p(File.expand_path('../../tmp/cache', __FILE__))
11
23
 
12
- module TestHelper
13
- Routes = ActionDispatch::Routing::RouteSet.new
14
- Routes.draw do
15
- resource :hypermedia
16
- get ':controller(/:action(/:id))'
17
- get ':controller(/:action)'
18
- end
19
-
20
- ActionController::Base.send :include, Routes.url_helpers
21
- ActiveModel::Serializer.send :include, Routes.url_helpers
24
+ gem 'minitest'
25
+ begin
26
+ require 'minitest'
27
+ rescue LoadError
28
+ # Minitest 4
29
+ require 'minitest/autorun'
30
+ $minitest_version = 4
31
+ # https://github.com/seattlerb/minitest/blob/644a52fd0/lib/minitest/autorun.rb
32
+ # https://github.com/seattlerb/minitest/blob/644a52fd0/lib/minitest/unit.rb#L768-L787
33
+ # Ensure backward compatibility with Minitest 4
34
+ Minitest = MiniTest unless defined?(Minitest)
35
+ Minitest::Test = MiniTest::Unit::TestCase
36
+ else
37
+ # Minitest 5
38
+ require 'minitest/autorun'
39
+ $minitest_version = 5
40
+ # https://github.com/seattlerb/minitest/blob/e21fdda9d/lib/minitest/autorun.rb
41
+ # https://github.com/seattlerb/minitest/blob/e21fdda9d/lib/minitest.rb#L45-L59
22
42
  end
43
+ require 'minitest/reporters'
44
+ Minitest::Reporters.use!
23
45
 
24
- ActiveSupport::TestCase.class_eval do
25
- setup do
26
- @routes = ::TestHelper::Routes
27
- end
28
- end
46
+ require 'support/stream_capture'
47
+
48
+ require 'support/rails_app'
49
+
50
+ require 'support/test_case'
51
+
52
+ require 'support/serialization_testing'
53
+
54
+ require 'support/rails5_shims'
55
+
56
+ require 'fixtures/active_record'
57
+
58
+ require 'fixtures/poro'
29
59
 
30
- class Object
31
- undef_method :id if respond_to?(:id)
60
+ ActiveSupport.on_load(:action_controller) do
61
+ $action_controller_logger = ActiveModelSerializers.logger
62
+ ActiveModelSerializers.logger = Logger.new(IO::NULL)
32
63
  end