rails_stuff 0.5.1 → 0.6.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/CHANGELOG.md +29 -0
  4. data/Gemfile +1 -0
  5. data/README.md +37 -16
  6. data/gemfiles/rails_4.gemfile +1 -0
  7. data/gemfiles/rails_5.gemfile +1 -0
  8. data/lib/rails_stuff/engine.rb +1 -1
  9. data/lib/rails_stuff/resources_controller/actions.rb +3 -3
  10. data/lib/rails_stuff/resources_controller/basic_helpers.rb +1 -1
  11. data/lib/rails_stuff/resources_controller/resource_helper.rb +32 -14
  12. data/lib/rails_stuff/resources_controller.rb +0 -2
  13. data/lib/rails_stuff/responders/turbolinks.rb +13 -0
  14. data/lib/rails_stuff/responders.rb +19 -0
  15. data/lib/rails_stuff/rspec_helpers/concurrency.rb +45 -0
  16. data/lib/rails_stuff/rspec_helpers/groups/feature.rb +25 -0
  17. data/lib/rails_stuff/rspec_helpers/groups/request.rb +79 -0
  18. data/lib/rails_stuff/rspec_helpers/matchers/be_valid_js.rb +12 -0
  19. data/lib/rails_stuff/rspec_helpers/matchers/redirect_with_turbolinks.rb +53 -0
  20. data/lib/rails_stuff/rspec_helpers/signinable.rb +21 -0
  21. data/lib/rails_stuff/rspec_helpers.rb +123 -0
  22. data/lib/rails_stuff/sort_scope.rb +19 -0
  23. data/lib/rails_stuff/statusable/builder.rb +114 -0
  24. data/lib/rails_stuff/statusable/helper.rb +64 -0
  25. data/lib/rails_stuff/statusable/mapped_builder.rb +48 -0
  26. data/lib/rails_stuff/statusable/mapped_helper.rb +46 -0
  27. data/lib/rails_stuff/statusable.rb +53 -199
  28. data/lib/rails_stuff/test_helpers/concurrency.rb +1 -32
  29. data/lib/rails_stuff/test_helpers/integration_session.rb +18 -0
  30. data/lib/rails_stuff/test_helpers/response.rb +10 -0
  31. data/lib/rails_stuff/test_helpers.rb +50 -0
  32. data/lib/rails_stuff/types_tracker.rb +1 -1
  33. data/lib/rails_stuff/version.rb +13 -3
  34. data/lib/rails_stuff.rb +3 -0
  35. metadata +20 -8
  36. data/lib/rails_stuff/resources_controller/responder.rb +0 -21
  37. data/lib/rails_stuff/test_helpers/configurator.rb +0 -60
  38. data/lib/rails_stuff/test_helpers/rails.rb +0 -9
@@ -18,6 +18,20 @@ module RailsStuff
18
18
  # It supports mapped statuses, just provide a hash with
19
19
  # `{status_name => interna_value}` instead of array of statuses.
20
20
  module Statusable
21
+ autoload :Helper, 'rails_stuff/statusable/helper'
22
+ autoload :Builder, 'rails_stuff/statusable/builder'
23
+ autoload :MappedHelper, 'rails_stuff/statusable/mapped_helper'
24
+ autoload :MappedBuilder, 'rails_stuff/statusable/mapped_builder'
25
+
26
+ class << self
27
+ # Fetches statuses list from model constants. See #has_status_field.
28
+ def fetch_statuses(model, field)
29
+ const_name = "#{field.to_s.pluralize.upcase}_MAPPING"
30
+ const_name = field.to_s.pluralize.upcase unless model.const_defined?(const_name)
31
+ model.const_get(const_name)
32
+ end
33
+ end
34
+
21
35
  # Defines all helpers working with `field` (default to `status`).
22
36
  # List of values can be given as second argument, otherwise it'll
23
37
  # be read from consts using pluralized name of `field`
@@ -36,17 +50,48 @@ module RailsStuff
36
50
  # - `suffix` - similar to `prefix`.
37
51
  #
38
52
  # - `validate` - additional options for validatior. `false` to disable it.
39
- def has_status_field(field = :status, statuses = nil, **options)
40
- unless statuses
41
- const_name = "#{field.to_s.pluralize.upcase}_MAPPING"
42
- const_name = field.to_s.pluralize.upcase unless const_defined?(const_name)
43
- statuses = const_get(const_name)
53
+ #
54
+ # - `helper` - custom helper class.
55
+ #
56
+ # - `builder` - custom methods builder class.
57
+ #
58
+ # - `mapping` - shortcut for `statuses` param (see examples).
59
+ #
60
+ # Pass block to customize methods generation process (see Builder for available methods):
61
+ #
62
+ # # This will define only scope with status names, but no other methods.
63
+ # has_status_field do |builder|
64
+ # builder.value_scopes
65
+ # end
66
+ #
67
+ # Examples:
68
+ #
69
+ # # Setup #status field, take list from STATUSES or STATUSES_MAPPING constant.
70
+ # has_status_field
71
+ # # Custom field, take kist from KINDS or KINDS_MAPPING:
72
+ # has_status_field :kind
73
+ # # Inline statuses list and options:
74
+ # has_status_field :status, %i(one two), prefix: :my_
75
+ # has_status_field :status, {one: 1, two: 2}, prefix: :my_
76
+ # has_status_field :status, mapping: {one: 1, two: 2}, prefix: :my_
77
+ # # Mapped field without options:
78
+ # has_status_field :status, {one: 1, two: 2}, {}
79
+ # has_status_field :status, mapping: {one: 1, two: 2}
80
+ #
81
+ def has_status_field(field = :status, statuses = nil, mapping: nil, **options)
82
+ statuses ||= mapping || Statusable.fetch_statuses(self, field)
83
+ is_mapped = statuses.is_a?(Hash)
84
+ helper_class = options.fetch(:helper) { is_mapped ? MappedHelper : Helper }
85
+ helper = helper_class.new(self, field, statuses)
86
+ helper.attach
87
+ builder_class = options.fetch(:builder) { is_mapped ? MappedBuilder : Builder }
88
+ if builder_class
89
+ builder = builder_class.new(helper, options)
90
+ block_given? ? yield(builder) : builder.generate
44
91
  end
45
- generator = statuses.is_a?(Hash) ? MappedBuilder : Builder
46
- generator.new(self, field, statuses, options).generate
47
92
  end
48
93
 
49
- # Module to hold generated methods.
94
+ # Module to hold generated methods. Single for all status fields in model.
50
95
  def statusable_methods
51
96
  # Include generated methods with a module, not right in class.
52
97
  @statusable_methods ||= Module.new.tap do |m|
@@ -55,196 +100,5 @@ module RailsStuff
55
100
  extend m::ClassMethods
56
101
  end
57
102
  end
58
-
59
- # Generates methods and scopes.
60
- class Builder
61
- attr_reader :model, :field, :statuses, :options, :prefix, :suffix
62
- alias_method :statuses_list, :statuses
63
-
64
- def initialize(model, field, statuses, **options)
65
- @model = model
66
- @field = field
67
- @statuses = statuses
68
- @options = options
69
- @prefix = options[:prefix]
70
- @suffix = options[:suffix]
71
- end
72
-
73
- def generate
74
- validations unless options[:validate] == false
75
- field_reader
76
- field_writer
77
- select_options_helper
78
- translation_helpers
79
- field_scope
80
- value_methods
81
- end
82
-
83
- def validations
84
- model.validates_inclusion_of field,
85
- {in: statuses.map(&:to_s)}.merge!(options.fetch(:validate, {}))
86
- end
87
-
88
- # Scope with given status. Useful for has_scope.
89
- def field_scope
90
- field = self.field
91
- define_scope "with_#{field}", ->(status) { where(field => status) }
92
- end
93
-
94
- def value_methods
95
- field = self.field
96
- statuses.map(&:to_s).each do |status_name|
97
- # Scopes for every status.
98
- define_scope "#{prefix}#{status_name}#{suffix}",
99
- -> { where(field => status_name) }
100
- define_scope "not_#{prefix}#{status_name}#{suffix}",
101
- -> { where.not(field => status_name) }
102
- status_accessor status_name, status_name
103
- end
104
- end
105
-
106
- # Generates methods for specific value.
107
- def status_accessor(status_name, value)
108
- field = self.field
109
-
110
- # Shortcut to check status.
111
- define_method "#{prefix}#{status_name}#{suffix}?" do
112
- self[field] == value
113
- end
114
-
115
- # Shortcut to update status.
116
- define_method "#{prefix}#{status_name}#{suffix}!" do
117
- update_attributes!(field => value)
118
- end
119
- end
120
-
121
- # Make field accept sympbols.
122
- def field_writer
123
- define_method "#{field}=" do |val|
124
- val = val.to_s if val.is_a?(Symbol)
125
- super(val)
126
- end
127
- end
128
-
129
- # Status as symbol.
130
- def field_reader
131
- field = self.field
132
- define_method "#{field}_sym" do
133
- val = send(field)
134
- val && val.to_sym
135
- end
136
- end
137
-
138
- def translation_helpers
139
- field = self.field
140
- sym_method = "#{field}_sym"
141
-
142
- # Class-level translation helper.
143
- generate_class_method "#{field}_name" do |status|
144
- t(".#{field}_name.#{status}") if status
145
- end
146
-
147
- # Translation helper.
148
- define_method "#{field}_name" do
149
- val = send(sym_method)
150
- self.class.t(".#{field}_name.#{val}") if val
151
- end
152
- end
153
-
154
- def select_options_helper
155
- statuses_list = self.statuses_list
156
- translation_method = :"#{field}_name"
157
- # Returns array compatible with select_options helper.
158
- generate_class_method "#{field}_select_options" do |args = {}|
159
- filtered_statuses = statuses_list - Array.wrap(args[:except])
160
- filtered_statuses.map { |x| [send(translation_method, x), x] }
161
- end
162
- end
163
-
164
- # Rails 4 doesn't use `instance_exec` for scopes, so we do it manually.
165
- # For Rails 5 it's just use `.scope`.
166
- def define_scope(name, body)
167
- if RailsStuff.rails4?
168
- model.singleton_class.send(:define_method, name) do |*args|
169
- all.scoping { instance_exec(*args, &body) } || all
170
- end
171
- else
172
- model.scope(name, body)
173
- end
174
- end
175
-
176
- def define_method(method, &block)
177
- model.statusable_methods.send(:define_method, method, &block)
178
- end
179
-
180
- def generate_class_method(method, &block)
181
- model.statusable_methods::ClassMethods.send(:define_method, method, &block)
182
- end
183
- end
184
-
185
- # Generates methods and scopes when status names are mapped to internal values.
186
- class MappedBuilder < Builder
187
- attr_reader :mapping, :statuses_list
188
-
189
- def initialize(*)
190
- super
191
- @mapping = statuses.with_indifferent_access
192
- @statuses_list = statuses.keys
193
- end
194
-
195
- def validations
196
- model.validates_inclusion_of field,
197
- {in: statuses.values}.merge!(options.fetch(:validate, {}))
198
- end
199
-
200
- # Scope with given status. Useful for has_scope.
201
- def field_scope
202
- field = self.field
203
- mapping = self.mapping
204
- define_scope "with_#{field}", ->(status) do
205
- values = Array.wrap(status).map { |x| mapping.fetch(x, x) }
206
- where(field => values)
207
- end
208
- end
209
-
210
- def value_methods
211
- field = self.field
212
- statuses.each do |status_name, value|
213
- # Scopes for every status.
214
- define_scope "#{prefix}#{status_name}#{suffix}", -> { where(field => value) }
215
- define_scope "not_#{prefix}#{status_name}#{suffix}", -> { where.not(field => value) }
216
- status_accessor status_name, value
217
- end
218
- end
219
-
220
- def field_reader
221
- field = self.field
222
- inverse_mapping = statuses.stringify_keys.invert
223
-
224
- # Returns status name.
225
- define_method field do |mapped = false|
226
- val = super()
227
- return val unless mapped && val
228
- mapped = inverse_mapping[val]
229
- raise "Missing mapping for value #{val.inspect}" unless mapped
230
- mapped
231
- end
232
-
233
- # Status as symbol.
234
- define_method "#{field}_sym" do
235
- val = public_send(field, true)
236
- val && val.to_sym
237
- end
238
- end
239
-
240
- def field_writer
241
- mapping = self.mapping
242
- # Make field accept sympbols.
243
- define_method "#{field}=" do |val|
244
- val = val.to_s if val.is_a?(Symbol)
245
- super(mapping.fetch(val, val))
246
- end
247
- end
248
- end
249
103
  end
250
104
  end
@@ -1,46 +1,15 @@
1
- require 'active_support/concern'
2
1
  require 'active_support/core_ext/array/wrap'
3
2
 
4
3
  module RailsStuff
5
4
  module TestHelpers
6
5
  module Concurrency
7
- extend ActiveSupport::Concern
8
-
9
6
  class << self
10
7
  # Default threads count
11
8
  attr_accessor :threads_count
12
9
  end
13
10
  @threads_count = 3
14
11
 
15
- module ClassMethods
16
- # Defines subject which runs parent's value in multiple threads concurrently.
17
- # Define `thread_args` or `threads_count` with `let` to configure it.
18
- def concurrent_subject!
19
- metadata[:concurrent] = true
20
- subject do
21
- super_proc = super()
22
- args = defined?(thread_args) && thread_args
23
- args ||= defined?(threads_count) && threads_count
24
- -> { concurrently(args, &super_proc) }
25
- end
26
- end
27
-
28
- # Runs given block in current context and nested context with concurrent subject.
29
- #
30
- # subject { -> { increment_value_once } }
31
- # # This will create 2 examples. One for current contex, and one
32
- # # for current context where subject will run multiple times concurrently.
33
- # check_concurrent do
34
- # it { should change { value }.by(1) }
35
- # end
36
- def check_concurrent(&block)
37
- instance_eval(&block)
38
- context 'running multiple times concurrently' do
39
- concurrent_subject!
40
- instance_eval(&block)
41
- end
42
- end
43
- end
12
+ extend self
44
13
 
45
14
  # Runs block concurrently in separate threads.
46
15
  # Pass array of args arrays to run each thread with its own arguments.
@@ -0,0 +1,18 @@
1
+ module RailsStuff
2
+ module TestHelpers
3
+ module IntegrationSession
4
+ # Return smth usable instead of status code.
5
+ def process(*)
6
+ super
7
+ response
8
+ end
9
+
10
+ # Set host explicitly, because it can change after request.
11
+ def default_url_options
12
+ super.merge(host: host)
13
+ end
14
+
15
+ ActionDispatch::Integration::Session.prepend(self) if defined?(ActionDispatch)
16
+ end
17
+ end
18
+ end
@@ -15,6 +15,14 @@ module RailsStuff
15
15
  end
16
16
  end
17
17
 
18
+ # Missing enquirers.
19
+ {
20
+ unprocessable_entity: 422,
21
+ no_content: 204,
22
+ }.each do |name, code|
23
+ define_method("#{name}?") { status == code }
24
+ end
25
+
18
26
  # Easy access to json bodies. It parses and return `Hashie::Mash`'es, so
19
27
  # properties can be accessed via method calls:
20
28
  #
@@ -29,6 +37,8 @@ module RailsStuff
29
37
  def inspect
30
38
  "<Response(#{status})>"
31
39
  end
40
+
41
+ ActionDispatch::TestResponse.send(:include, self) if defined?(ActionDispatch)
32
42
  end
33
43
  end
34
44
  end
@@ -0,0 +1,50 @@
1
+ require 'active_support/core_ext/array/wrap'
2
+
3
+ module RailsStuff
4
+ # Collection of RSpec configurations and helpers for better experience.
5
+ module TestHelpers
6
+ extend self
7
+
8
+ def setup(only: nil, except: nil)
9
+ items = instance_methods.map(&:to_s) - %w(setup)
10
+ items -= Array.wrap(except).map(&:to_s) if except
11
+ if only
12
+ only = Array.wrap(only).map(&:to_s)
13
+ items &= only
14
+ items += only
15
+ end
16
+ items.each { |item| public_send(item) }
17
+ end
18
+
19
+ %w(
20
+ integration_session
21
+ response
22
+ ).each do |file|
23
+ define_method(file.tr('/', '_')) { require "rails_stuff/test_helpers/#{file}" }
24
+ end
25
+
26
+ # Make BigDecimal`s more readable.
27
+ def big_decimal
28
+ require 'bigdecimal'
29
+ BigDecimal.class_eval do
30
+ alias_method :inspect_orig, :inspect
31
+ alias_method :inspect, :to_s
32
+ end
33
+ end
34
+
35
+ # Raise errors from failed threads.
36
+ def thread
37
+ Thread.abort_on_exception = true
38
+ end
39
+
40
+ # Raise all translation errors, to not miss any of translations.
41
+ # Make sure to set `config.action_view.raise_on_missing_translations = true` in
42
+ # `config/environments/test.rb` yourself.
43
+ def i18n
44
+ return unless defined?(I18n)
45
+ I18n.config.exception_handler = ->(exception, _locale, _key, _options) do
46
+ raise exception.respond_to?(:to_exception) ? exception.to_exception : exception
47
+ end
48
+ end
49
+ end
50
+ end
@@ -6,7 +6,7 @@ module RailsStuff
6
6
  # Also allows to remove any of descendants from this list.
7
7
  # Useful for STI models to track all available types.
8
8
  #
9
- # Railtie adds `to_prepare` callback, which will automatically load types.
9
+ # Use with RequireNested to preload all nested classes.
10
10
  module TypesTracker
11
11
  class << self
12
12
  def extended(base)
@@ -5,10 +5,20 @@ module RailsStuff
5
5
 
6
6
  module VERSION #:nodoc:
7
7
  MAJOR = 0
8
- MINOR = 5
9
- TINY = 1
10
- PRE = nil
8
+ MINOR = 6
9
+ TINY = 0
10
+ PRE = 'rc1'.freeze
11
11
 
12
12
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
13
+
14
+ class << self
15
+ def to_s
16
+ STRING
17
+ end
18
+
19
+ def inspect
20
+ STRING.inspect
21
+ end
22
+ end
13
23
  end
14
24
  end
data/lib/rails_stuff.rb CHANGED
@@ -14,8 +14,11 @@ module RailsStuff
14
14
  autoload :RedisStorage
15
15
  autoload :RequireNested
16
16
  autoload :ResourcesController
17
+ autoload :Responders
18
+ autoload :RSpecHelpers, 'rails_stuff/rspec_helpers'
17
19
  autoload :SortScope
18
20
  autoload :Statusable
21
+ autoload :TestHelpers, 'rails_stuff/test_helpers'
19
22
  autoload :TypesTracker
20
23
 
21
24
  module_function
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_stuff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Melentiev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-25 00:00:00.000000000 Z
11
+ date: 2017-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -110,14 +110,26 @@ files:
110
110
  - lib/rails_stuff/resources_controller/has_scope_helpers.rb
111
111
  - lib/rails_stuff/resources_controller/kaminari_helpers.rb
112
112
  - lib/rails_stuff/resources_controller/resource_helper.rb
113
- - lib/rails_stuff/resources_controller/responder.rb
114
113
  - lib/rails_stuff/resources_controller/sti_helpers.rb
114
+ - lib/rails_stuff/responders.rb
115
+ - lib/rails_stuff/responders/turbolinks.rb
116
+ - lib/rails_stuff/rspec_helpers.rb
117
+ - lib/rails_stuff/rspec_helpers/concurrency.rb
118
+ - lib/rails_stuff/rspec_helpers/groups/feature.rb
119
+ - lib/rails_stuff/rspec_helpers/groups/request.rb
120
+ - lib/rails_stuff/rspec_helpers/matchers/be_valid_js.rb
121
+ - lib/rails_stuff/rspec_helpers/matchers/redirect_with_turbolinks.rb
122
+ - lib/rails_stuff/rspec_helpers/signinable.rb
115
123
  - lib/rails_stuff/sort_scope.rb
116
124
  - lib/rails_stuff/statusable.rb
125
+ - lib/rails_stuff/statusable/builder.rb
126
+ - lib/rails_stuff/statusable/helper.rb
127
+ - lib/rails_stuff/statusable/mapped_builder.rb
128
+ - lib/rails_stuff/statusable/mapped_helper.rb
117
129
  - lib/rails_stuff/strong_parameters.rb
130
+ - lib/rails_stuff/test_helpers.rb
118
131
  - lib/rails_stuff/test_helpers/concurrency.rb
119
- - lib/rails_stuff/test_helpers/configurator.rb
120
- - lib/rails_stuff/test_helpers/rails.rb
132
+ - lib/rails_stuff/test_helpers/integration_session.rb
121
133
  - lib/rails_stuff/test_helpers/response.rb
122
134
  - lib/rails_stuff/types_tracker.rb
123
135
  - lib/rails_stuff/url_for_keeping_params.rb
@@ -138,12 +150,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
138
150
  version: '0'
139
151
  required_rubygems_version: !ruby/object:Gem::Requirement
140
152
  requirements:
141
- - - ">="
153
+ - - ">"
142
154
  - !ruby/object:Gem::Version
143
- version: '0'
155
+ version: 1.3.1
144
156
  requirements: []
145
157
  rubyforge_project:
146
- rubygems_version: 2.5.1
158
+ rubygems_version: 2.6.8
147
159
  signing_key:
148
160
  specification_version: 4
149
161
  summary: Collection of useful modules for Rails
@@ -1,21 +0,0 @@
1
- module RailsStuff
2
- module ResourcesController
3
- # Default responder class.
4
- class Responder < ActionController::Responder
5
- include Responders::FlashResponder
6
- include Responders::HttpCacheResponder
7
-
8
- # Similar to `.to_html`. Redirect is performed via turbolinks.
9
- def to_js
10
- default_render
11
- rescue ActionView::MissingTemplate
12
- raise if get?
13
- if has_errors?
14
- render resource.persisted? ? :edit : :new
15
- else
16
- redirect_via_turbolinks_to controller.url_for(resource_location)
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,60 +0,0 @@
1
- module RailsStuff
2
- module TestHelpers
3
- # Collection of useful RSpec configurations.
4
- #
5
- # RailsStuff::TestHelpers::Configurator.tap do |configurator|
6
- # configurator.database_cleaner(config)
7
- # # ...
8
- # end
9
- #
10
- module Configurator
11
- module_function
12
-
13
- # Setups database cleaner to use strategy depending on metadata.
14
- # By default it uses `:transaction` for all examples and `:truncation`
15
- # for features and examples with `concurrent: true`.
16
- #
17
- # Other types can be tuned with `config.cleaner_strategy` hash &
18
- # `config.cleaner_strategy.default`.
19
- def database_cleaner(config)
20
- config.use_transactional_fixtures = false
21
- config.add_setting :cleaner_strategy
22
- config.cleaner_strategy = {feature: :truncation}
23
- config.cleaner_strategy.default = :transaction
24
- config.around do |ex|
25
- strategy = ex.metadata[:concurrent] && :truncation
26
- strategy ||= config.cleaner_strategy[ex.metadata[:type]]
27
- options = strategy == :truncation ? {except: %w(spatial_ref_sys)} : {}
28
- DatabaseCleaner.strategy = strategy, options
29
- DatabaseCleaner.cleaning { ex.run }
30
- end
31
- end
32
-
33
- # Setups redis to flush db after suite and before each example with
34
- # `flush_redis: :true`. `Rails.redis` client is used by default.
35
- # Can be tuned with `config.redis`.
36
- def redis(config)
37
- config.add_setting :redis
38
- config.redis = Rails.redis if defined?(Rails.redis)
39
- config.before { |ex| config.redis.flushdb if ex.metadata[:flush_redis] }
40
- config.after(:suite) { config.redis.flushdb }
41
- end
42
-
43
- # Runs debugger after each failed example. Uses `pry` by default and
44
- # runs only for examples with `:debug` tag. This can be configured
45
- # with `:debugger` and `:filter` options respectively:
46
- #
47
- # configurator.debug(config, filter: {my_tag: :val}, debugger: true)
48
- # # to disable filter:
49
- # configurator.debug(config, filter: nil)
50
- def debug(config, filter: {debug: true}, debugger: :pry)
51
- config.after(filter) do |ex|
52
- if ex.exception
53
- debugger == :pry ? binding.pry : self.debugger # rubocop:disable Debugger
54
- ex.exception # noop
55
- end
56
- end
57
- end
58
- end
59
- end
60
- end
@@ -1,9 +0,0 @@
1
- require 'action_dispatch'
2
- require 'rails_stuff/test_helpers/response'
3
-
4
- ActionDispatch::TestResponse.class_eval do
5
- include RailsStuff::TestHelpers::Response
6
- end
7
-
8
- require 'rails_stuff/test_helpers/concurrency'
9
- require 'rails_stuff/test_helpers/configurator'