active_model_serializers 0.10.0 → 0.10.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (206) hide show
  1. checksums.yaml +5 -5
  2. data/.rubocop.yml +10 -5
  3. data/.travis.yml +41 -21
  4. data/CHANGELOG.md +200 -2
  5. data/CODE_OF_CONDUCT.md +74 -0
  6. data/Gemfile +25 -4
  7. data/README.md +166 -28
  8. data/Rakefile +5 -32
  9. data/active_model_serializers.gemspec +23 -25
  10. data/appveyor.yml +10 -6
  11. data/bin/rubocop +38 -0
  12. data/docs/README.md +2 -1
  13. data/docs/general/adapters.md +35 -11
  14. data/docs/general/caching.md +7 -1
  15. data/docs/general/configuration_options.md +86 -1
  16. data/docs/general/deserialization.md +1 -1
  17. data/docs/general/fields.md +31 -0
  18. data/docs/general/getting_started.md +1 -1
  19. data/docs/general/logging.md +7 -0
  20. data/docs/general/rendering.md +63 -25
  21. data/docs/general/serializers.md +137 -14
  22. data/docs/howto/add_pagination_links.md +16 -17
  23. data/docs/howto/add_relationship_links.md +140 -0
  24. data/docs/howto/add_root_key.md +11 -0
  25. data/docs/howto/grape_integration.md +42 -0
  26. data/docs/howto/outside_controller_use.md +12 -4
  27. data/docs/howto/passing_arbitrary_options.md +2 -2
  28. data/docs/howto/serialize_poro.md +46 -5
  29. data/docs/howto/test.md +2 -0
  30. data/docs/howto/upgrade_from_0_8_to_0_10.md +265 -0
  31. data/docs/integrations/ember-and-json-api.md +67 -32
  32. data/docs/jsonapi/schema.md +1 -1
  33. data/lib/action_controller/serialization.rb +15 -3
  34. data/lib/active_model/serializable_resource.rb +2 -0
  35. data/lib/active_model/serializer/adapter/attributes.rb +2 -0
  36. data/lib/active_model/serializer/adapter/base.rb +4 -0
  37. data/lib/active_model/serializer/adapter/json.rb +2 -0
  38. data/lib/active_model/serializer/adapter/json_api.rb +2 -0
  39. data/lib/active_model/serializer/adapter/null.rb +2 -0
  40. data/lib/active_model/serializer/adapter.rb +2 -0
  41. data/lib/active_model/serializer/array_serializer.rb +10 -5
  42. data/lib/active_model/serializer/association.rb +64 -10
  43. data/lib/active_model/serializer/attribute.rb +2 -0
  44. data/lib/active_model/serializer/belongs_to_reflection.rb +6 -3
  45. data/lib/active_model/serializer/collection_serializer.rb +39 -13
  46. data/lib/active_model/serializer/{caching.rb → concerns/caching.rb} +87 -116
  47. data/lib/active_model/serializer/error_serializer.rb +13 -7
  48. data/lib/active_model/serializer/errors_serializer.rb +27 -20
  49. data/lib/active_model/serializer/field.rb +2 -0
  50. data/lib/active_model/serializer/fieldset.rb +2 -0
  51. data/lib/active_model/serializer/has_many_reflection.rb +5 -3
  52. data/lib/active_model/serializer/has_one_reflection.rb +3 -4
  53. data/lib/active_model/serializer/lazy_association.rb +99 -0
  54. data/lib/active_model/serializer/link.rb +23 -0
  55. data/lib/active_model/serializer/lint.rb +136 -130
  56. data/lib/active_model/serializer/null.rb +2 -0
  57. data/lib/active_model/serializer/reflection.rb +132 -67
  58. data/lib/active_model/serializer/version.rb +3 -1
  59. data/lib/active_model/serializer.rb +308 -82
  60. data/lib/active_model_serializers/adapter/attributes.rb +5 -66
  61. data/lib/active_model_serializers/adapter/base.rb +41 -39
  62. data/lib/active_model_serializers/adapter/json.rb +2 -0
  63. data/lib/active_model_serializers/adapter/json_api/deserialization.rb +4 -2
  64. data/lib/active_model_serializers/adapter/json_api/error.rb +2 -0
  65. data/lib/active_model_serializers/adapter/json_api/jsonapi.rb +2 -0
  66. data/lib/active_model_serializers/adapter/json_api/link.rb +3 -1
  67. data/lib/active_model_serializers/adapter/json_api/meta.rb +2 -0
  68. data/lib/active_model_serializers/adapter/json_api/pagination_links.rb +49 -21
  69. data/lib/active_model_serializers/adapter/json_api/relationship.rb +77 -23
  70. data/lib/active_model_serializers/adapter/json_api/resource_identifier.rb +41 -10
  71. data/lib/active_model_serializers/adapter/json_api.rb +84 -65
  72. data/lib/active_model_serializers/adapter/null.rb +2 -0
  73. data/lib/active_model_serializers/adapter.rb +9 -1
  74. data/lib/active_model_serializers/callbacks.rb +2 -0
  75. data/lib/active_model_serializers/deprecate.rb +3 -2
  76. data/lib/active_model_serializers/deserialization.rb +4 -0
  77. data/lib/active_model_serializers/json_pointer.rb +2 -0
  78. data/lib/active_model_serializers/logging.rb +2 -0
  79. data/lib/active_model_serializers/lookup_chain.rb +82 -0
  80. data/lib/active_model_serializers/model.rb +111 -28
  81. data/lib/active_model_serializers/railtie.rb +7 -1
  82. data/lib/active_model_serializers/register_jsonapi_renderer.rb +46 -31
  83. data/lib/active_model_serializers/serializable_resource.rb +10 -7
  84. data/lib/active_model_serializers/serialization_context.rb +12 -3
  85. data/lib/active_model_serializers/test/schema.rb +4 -2
  86. data/lib/active_model_serializers/test/serializer.rb +2 -0
  87. data/lib/active_model_serializers/test.rb +2 -0
  88. data/lib/active_model_serializers.rb +35 -10
  89. data/lib/generators/rails/resource_override.rb +3 -1
  90. data/lib/generators/rails/serializer_generator.rb +6 -4
  91. data/lib/grape/active_model_serializers.rb +9 -5
  92. data/lib/grape/formatters/active_model_serializers.rb +21 -2
  93. data/lib/grape/helpers/active_model_serializers.rb +3 -0
  94. data/lib/tasks/rubocop.rake +55 -0
  95. data/test/action_controller/adapter_selector_test.rb +16 -5
  96. data/test/action_controller/explicit_serializer_test.rb +7 -4
  97. data/test/action_controller/json/include_test.rb +108 -27
  98. data/test/action_controller/json_api/deserialization_test.rb +3 -1
  99. data/test/action_controller/json_api/errors_test.rb +10 -9
  100. data/test/action_controller/json_api/fields_test.rb +68 -0
  101. data/test/action_controller/json_api/linked_test.rb +31 -24
  102. data/test/action_controller/json_api/pagination_test.rb +33 -23
  103. data/test/action_controller/json_api/transform_test.rb +13 -3
  104. data/test/action_controller/lookup_proc_test.rb +51 -0
  105. data/test/action_controller/namespace_lookup_test.rb +234 -0
  106. data/test/action_controller/serialization_scope_name_test.rb +14 -6
  107. data/test/action_controller/serialization_test.rb +23 -12
  108. data/test/active_model_serializers/adapter_for_test.rb +2 -0
  109. data/test/active_model_serializers/json_pointer_test.rb +17 -13
  110. data/test/active_model_serializers/logging_test.rb +2 -0
  111. data/test/active_model_serializers/model_test.rb +139 -4
  112. data/test/active_model_serializers/railtie_test_isolated.rb +14 -7
  113. data/test/active_model_serializers/register_jsonapi_renderer_test_isolated.rb +163 -0
  114. data/test/active_model_serializers/serialization_context_test_isolated.rb +25 -10
  115. data/test/active_model_serializers/test/schema_test.rb +5 -2
  116. data/test/active_model_serializers/test/serializer_test.rb +2 -0
  117. data/test/active_record_test.rb +2 -0
  118. data/test/adapter/attributes_test.rb +42 -0
  119. data/test/adapter/deprecation_test.rb +2 -0
  120. data/test/adapter/json/belongs_to_test.rb +2 -0
  121. data/test/adapter/json/collection_test.rb +16 -0
  122. data/test/adapter/json/has_many_test.rb +12 -2
  123. data/test/adapter/json/transform_test.rb +17 -15
  124. data/test/adapter/json_api/belongs_to_test.rb +2 -0
  125. data/test/adapter/json_api/collection_test.rb +6 -3
  126. data/test/adapter/json_api/errors_test.rb +19 -19
  127. data/test/adapter/json_api/fields_test.rb +14 -3
  128. data/test/adapter/json_api/has_many_explicit_serializer_test.rb +2 -0
  129. data/test/adapter/json_api/has_many_test.rb +51 -20
  130. data/test/adapter/json_api/has_one_test.rb +2 -0
  131. data/test/adapter/json_api/include_data_if_sideloaded_test.rb +215 -0
  132. data/test/adapter/json_api/json_api_test.rb +7 -7
  133. data/test/adapter/json_api/linked_test.rb +35 -12
  134. data/test/adapter/json_api/links_test.rb +22 -3
  135. data/test/adapter/json_api/pagination_links_test.rb +55 -13
  136. data/test/adapter/json_api/parse_test.rb +3 -1
  137. data/test/adapter/json_api/relationship_test.rb +311 -73
  138. data/test/adapter/json_api/resource_meta_test.rb +5 -3
  139. data/test/adapter/json_api/toplevel_jsonapi_test.rb +2 -0
  140. data/test/adapter/json_api/transform_test.rb +265 -253
  141. data/test/adapter/json_api/type_test.rb +170 -36
  142. data/test/adapter/json_test.rb +10 -7
  143. data/test/adapter/null_test.rb +3 -2
  144. data/test/adapter/polymorphic_test.rb +54 -5
  145. data/test/adapter_test.rb +3 -1
  146. data/test/array_serializer_test.rb +2 -0
  147. data/test/benchmark/app.rb +3 -1
  148. data/test/benchmark/benchmarking_support.rb +3 -1
  149. data/test/benchmark/bm_active_record.rb +83 -0
  150. data/test/benchmark/bm_adapter.rb +40 -0
  151. data/test/benchmark/bm_caching.rb +18 -16
  152. data/test/benchmark/bm_lookup_chain.rb +85 -0
  153. data/test/benchmark/bm_transform.rb +23 -10
  154. data/test/benchmark/controllers.rb +18 -17
  155. data/test/benchmark/fixtures.rb +74 -72
  156. data/test/cache_test.rb +301 -69
  157. data/test/collection_serializer_test.rb +33 -14
  158. data/test/fixtures/active_record.rb +47 -10
  159. data/test/fixtures/poro.rb +128 -183
  160. data/test/generators/scaffold_controller_generator_test.rb +2 -0
  161. data/test/generators/serializer_generator_test.rb +25 -5
  162. data/test/grape_test.rb +172 -56
  163. data/test/lint_test.rb +3 -1
  164. data/test/logger_test.rb +15 -11
  165. data/test/poro_test.rb +2 -0
  166. data/test/serializable_resource_test.rb +20 -22
  167. data/test/serializers/association_macros_test.rb +5 -2
  168. data/test/serializers/associations_test.rb +274 -49
  169. data/test/serializers/attribute_test.rb +7 -3
  170. data/test/serializers/attributes_test.rb +3 -1
  171. data/test/serializers/caching_configuration_test_isolated.rb +8 -6
  172. data/test/serializers/configuration_test.rb +2 -0
  173. data/test/serializers/fieldset_test.rb +3 -1
  174. data/test/serializers/meta_test.rb +14 -6
  175. data/test/serializers/options_test.rb +19 -6
  176. data/test/serializers/read_attribute_for_serialization_test.rb +5 -3
  177. data/test/serializers/reflection_test.rb +481 -0
  178. data/test/serializers/root_test.rb +3 -1
  179. data/test/serializers/serialization_test.rb +4 -2
  180. data/test/serializers/serializer_for_test.rb +14 -10
  181. data/test/serializers/serializer_for_with_namespace_test.rb +90 -0
  182. data/test/support/isolated_unit.rb +11 -4
  183. data/test/support/rails5_shims.rb +10 -2
  184. data/test/support/rails_app.rb +4 -9
  185. data/test/support/serialization_testing.rb +33 -5
  186. data/test/test_helper.rb +15 -0
  187. metadata +126 -46
  188. data/.rubocop_todo.yml +0 -167
  189. data/docs/ARCHITECTURE.md +0 -126
  190. data/lib/active_model/serializer/associations.rb +0 -100
  191. data/lib/active_model/serializer/attributes.rb +0 -82
  192. data/lib/active_model/serializer/collection_reflection.rb +0 -7
  193. data/lib/active_model/serializer/configuration.rb +0 -35
  194. data/lib/active_model/serializer/include_tree.rb +0 -111
  195. data/lib/active_model/serializer/links.rb +0 -35
  196. data/lib/active_model/serializer/meta.rb +0 -29
  197. data/lib/active_model/serializer/singular_reflection.rb +0 -7
  198. data/lib/active_model/serializer/type.rb +0 -25
  199. data/lib/active_model_serializers/key_transform.rb +0 -70
  200. data/test/active_model_serializers/key_transform_test.rb +0 -263
  201. data/test/adapter/json_api/has_many_embed_ids_test.rb +0 -43
  202. data/test/adapter/json_api/relationships_test.rb +0 -199
  203. data/test/adapter/json_api/resource_identifier_test.rb +0 -85
  204. data/test/include_tree/from_include_args_test.rb +0 -26
  205. data/test/include_tree/from_string_test.rb +0 -94
  206. data/test/include_tree/include_args_to_hash_test.rb +0 -64
@@ -0,0 +1,90 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'test_helper'
4
+
5
+ module ActiveModel
6
+ class Serializer
7
+ class SerializerForWithNamespaceTest < ActiveSupport::TestCase
8
+ class Book < ::Model
9
+ attributes :title, :author_name
10
+ associations :publisher, :pages
11
+ end
12
+ class Page < ::Model; attributes :number, :text end
13
+ class Publisher < ::Model; attributes :name end
14
+
15
+ module Api
16
+ module V3
17
+ class BookSerializer < ActiveModel::Serializer
18
+ attributes :title, :author_name
19
+
20
+ has_many :pages
21
+ belongs_to :publisher
22
+ end
23
+
24
+ class PageSerializer < ActiveModel::Serializer
25
+ attributes :number, :text
26
+ end
27
+
28
+ class PublisherSerializer < ActiveModel::Serializer
29
+ attributes :name
30
+ end
31
+ end
32
+ end
33
+
34
+ class BookSerializer < ActiveModel::Serializer
35
+ attributes :title, :author_name
36
+ end
37
+ test 'resource without a namespace' do
38
+ book = Book.new(title: 'A Post', author_name: 'hello')
39
+
40
+ # TODO: this should be able to pull up this serializer without explicitly specifying the serializer
41
+ # currently, with no options, it still uses the Api::V3 serializer
42
+ result = ActiveModelSerializers::SerializableResource.new(book, serializer: BookSerializer).serializable_hash
43
+
44
+ expected = { title: 'A Post', author_name: 'hello' }
45
+ assert_equal expected, result
46
+ end
47
+
48
+ test 'resource with namespace' do
49
+ book = Book.new(title: 'A Post', author_name: 'hi')
50
+
51
+ result = ActiveModelSerializers::SerializableResource.new(book, namespace: Api::V3).serializable_hash
52
+
53
+ expected = { title: 'A Post', author_name: 'hi', pages: nil, publisher: nil }
54
+ assert_equal expected, result
55
+ end
56
+
57
+ test 'has_many with nested serializer under the namespace' do
58
+ page = Page.new(number: 1, text: 'hello')
59
+ book = Book.new(title: 'A Post', author_name: 'hi', pages: [page])
60
+
61
+ result = ActiveModelSerializers::SerializableResource.new(book, namespace: Api::V3).serializable_hash
62
+
63
+ expected = {
64
+ title: 'A Post', author_name: 'hi',
65
+ publisher: nil,
66
+ pages: [{
67
+ number: 1, text: 'hello'
68
+ }]
69
+ }
70
+ assert_equal expected, result
71
+ end
72
+
73
+ test 'belongs_to with nested serializer under the namespace' do
74
+ publisher = Publisher.new(name: 'Disney')
75
+ book = Book.new(title: 'A Post', author_name: 'hi', publisher: publisher)
76
+
77
+ result = ActiveModelSerializers::SerializableResource.new(book, namespace: Api::V3).serializable_hash
78
+
79
+ expected = {
80
+ title: 'A Post', author_name: 'hi',
81
+ pages: nil,
82
+ publisher: {
83
+ name: 'Disney'
84
+ }
85
+ }
86
+ assert_equal expected, result
87
+ end
88
+ end
89
+ end
90
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # https://github.com/rails/rails/blob/v5.0.0.beta1/railties/test/isolation/abstract_unit.rb
2
4
 
3
5
  # Usage Example:
@@ -41,6 +43,7 @@ require 'active_support/core_ext/string/access'
41
43
 
42
44
  # These files do not require any others and are needed
43
45
  # to run the tests
46
+ require 'active_support/testing/autorun'
44
47
  require 'active_support/testing/isolation'
45
48
 
46
49
  module TestHelpers
@@ -53,7 +56,7 @@ module TestHelpers
53
56
  require 'rails'
54
57
  require 'action_controller/railtie'
55
58
 
56
- @app = Class.new(Rails::Application) do
59
+ app = Class.new(Rails::Application) do
57
60
  config.eager_load = false
58
61
  config.session_store :cookie_store, key: '_myapp_session'
59
62
  config.active_support.deprecation = :log
@@ -66,14 +69,18 @@ module TestHelpers
66
69
  config.logger = fake_logger
67
70
  Rails.application.routes.default_url_options = { host: 'example.com' }
68
71
  end
69
- @app.respond_to?(:secrets) && @app.secrets.secret_key_base = '3b7cd727ee24e8444053437c36cc66c4'
72
+ def app.name; 'IsolatedRailsApp'; end # rubocop:disable Style/SingleLineMethods
73
+ app.respond_to?(:secrets) && app.secrets.secret_key_base = '3b7cd727ee24e8444053437c36cc66c4'
70
74
 
75
+ @app = app
71
76
  yield @app if block_given?
72
77
  @app.initialize!
73
78
  end
74
79
  end
75
80
  end
76
81
 
77
- class ActiveSupport::TestCase
78
- include TestHelpers::Generation
82
+ module ActiveSupport
83
+ class TestCase
84
+ include TestHelpers::Generation
85
+ end
79
86
  end
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Rails5Shims
2
4
  module ControllerTests
3
5
  # https://github.com/rails/rails/blob/b217354/actionpack/lib/action_controller/test_case.rb
4
- REQUEST_KWARGS = [:params, :session, :flash, :method, :body, :xhr].freeze
6
+ REQUEST_KWARGS = [:params, :headers, :session, :flash, :method, :body, :xhr].freeze
5
7
 
6
8
  def get(path, *args)
7
9
  fold_kwargs!(args)
@@ -30,7 +32,12 @@ module Rails5Shims
30
32
  return unless hash.respond_to?(:key)
31
33
  Rails5Shims::ControllerTests::REQUEST_KWARGS.each do |kwarg|
32
34
  next unless hash.key?(kwarg)
33
- hash.merge! hash.delete(kwarg)
35
+ value = hash.delete(kwarg)
36
+ if value.is_a? String
37
+ args.insert(0, value)
38
+ else
39
+ hash.merge! value
40
+ end
34
41
  end
35
42
  end
36
43
 
@@ -44,4 +51,5 @@ module Rails5Shims
44
51
  end
45
52
  if Rails::VERSION::MAJOR < 5
46
53
  ActionController::TestCase.send :include, Rails5Shims::ControllerTests
54
+ ActionDispatch::IntegrationTest.send :include, Rails5Shims::ControllerTests
47
55
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'support/isolated_unit'
2
4
  module ActiveModelSerializers
3
5
  RailsApplication = TestHelpers::Generation.make_basic_app do |app|
@@ -6,6 +8,8 @@ module ActiveModelSerializers
6
8
  config.active_support.test_order = :random
7
9
  config.action_controller.perform_caching = true
8
10
  config.action_controller.cache_store = :memory_store
11
+
12
+ config.filter_parameters += [:password]
9
13
  end
10
14
 
11
15
  app.routes.default_url_options = { host: 'example.com' }
@@ -22,15 +26,6 @@ ActionController::TestCase.class_eval do
22
26
  def setup
23
27
  @routes = Routes
24
28
  end
25
-
26
- # For Rails5
27
- # https://github.com/rails/rails/commit/ca83436d1b3b6cedd1eca2259f65661e69b01909#diff-b9bbf56e85d3fe1999f16317f2751e76L17
28
- def assigns(key = nil)
29
- warn "DEPRECATION: Calling 'assigns(#{key})' from #{caller[0]}"
30
- assigns = {}.with_indifferent_access
31
- @controller.view_assigns.each { |k, v| assigns.regular_writer(k, v) }
32
- key.nil? ? assigns : assigns[key]
33
- end
34
29
  end
35
30
 
36
31
  # ActiveRecord::Migrator.migrations_paths = [File.expand_path("../../test/dummy/db/migrate", __FILE__)]
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SerializationTesting
2
4
  def config
3
5
  ActiveModelSerializers.config
@@ -9,6 +11,22 @@ module SerializationTesting
9
11
  ActiveModelSerializers::SerializableResource.new(obj).to_json
10
12
  end
11
13
 
14
+ def with_namespace_separator(separator)
15
+ original_separator = ActiveModelSerializers.config.jsonapi_namespace_separator
16
+ ActiveModelSerializers.config.jsonapi_namespace_separator = separator
17
+ yield
18
+ ensure
19
+ ActiveModelSerializers.config.jsonapi_namespace_separator = original_separator
20
+ end
21
+
22
+ def with_prepended_lookup(lookup_proc)
23
+ original_lookup = ActiveModelSerializers.config.serializer_lookup_cahin
24
+ ActiveModelSerializers.config.serializer_lookup_chain.unshift lookup_proc
25
+ yield
26
+ ensure
27
+ ActiveModelSerializers.config.serializer_lookup_cahin = original_lookup
28
+ end
29
+
12
30
  # Aliased as :with_configured_adapter to clarify that
13
31
  # this method tests the configured adapter.
14
32
  # When not testing configuration, it may be preferable
@@ -31,6 +49,14 @@ module SerializationTesting
31
49
  ActiveModelSerializers.config.replace(old_config)
32
50
  end
33
51
 
52
+ def with_jsonapi_inflection(inflection)
53
+ original_inflection = ActiveModelSerializers.config.jsonapi_resource_type
54
+ ActiveModelSerializers.config.jsonapi_resource_type = inflection
55
+ yield
56
+ ensure
57
+ ActiveModelSerializers.config.jsonapi_resource_type = original_inflection
58
+ end
59
+
34
60
  def with_serializer_lookup_disabled
35
61
  original_serializer_lookup = ActiveModelSerializers.config.serializer_lookup_enabled
36
62
  ActiveModelSerializers.config.serializer_lookup_enabled = false
@@ -44,10 +70,12 @@ module SerializationTesting
44
70
  end
45
71
  end
46
72
 
47
- class Minitest::Test
48
- def before_setup
49
- ActionController::Base.cache_store.clear
50
- end
73
+ module Minitest
74
+ class Test
75
+ def before_setup
76
+ ActionController::Base.cache_store.clear
77
+ end
51
78
 
52
- include SerializationTesting
79
+ include SerializationTesting
80
+ end
53
81
  end
data/test/test_helper.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Configure Rails Environment
2
4
  ENV['RAILS_ENV'] = 'test'
3
5
  require 'bundler/setup'
@@ -9,6 +11,7 @@ rescue LoadError
9
11
  STDERR.puts 'Running without SimpleCov'
10
12
  end
11
13
 
14
+ require 'pry'
12
15
  require 'timecop'
13
16
  require 'rails'
14
17
  require 'action_controller'
@@ -39,6 +42,18 @@ require 'minitest'
39
42
  require 'minitest/autorun'
40
43
  Minitest.backtrace_filter = Minitest::BacktraceFilter.new
41
44
 
45
+ module TestHelper
46
+ module_function
47
+
48
+ def silence_warnings
49
+ original_verbose = $VERBOSE
50
+ $VERBOSE = nil
51
+ yield
52
+ ensure
53
+ $VERBOSE = original_verbose
54
+ end
55
+ end
56
+
42
57
  require 'support/rails_app'
43
58
 
44
59
  # require "rails/test_help"