factory_bot_instrumentation 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 106c1aa5ca524b01dbff80a366493e8e921d2b65aba880d156da6481f6798d74
4
- data.tar.gz: 538be239cc2016d21996c85d96730c8501dfca703f5d7a1d259dc198aa0da880
3
+ metadata.gz: df9495f96882f162c18ca1c8467d09c34d8dc40981ed1a7ba541a7d5200867a9
4
+ data.tar.gz: 2ae4e05a4dbd3e729d56ffbfeafb2c14aeef6b6a8e825a6b94023bb6fa379823
5
5
  SHA512:
6
- metadata.gz: 423b35d7c9c7e590a1b312206f5f05a93407fa1fe3f5dff3790ae0ba9d263f782e7a3e8cbd24ae48307e422dd4806e15284b378b71f35792384d0fbf1739e449
7
- data.tar.gz: 6f2211b069039602f7e74bfa6a5d737acf2a651953ce81e6c758fed27625719f4128abb419dd5a66accfa5614c89e7663e65e9944bca09674e58f05244158b28
6
+ metadata.gz: c598dcbc2cf1cfc4f7e7c6d9a1e0389f7c9583e9208ae008db35cf320ba740232a9038fb6c00b92b06d95ca5483fee5663b88e70b39c6e7371624494d337f21f
7
+ data.tar.gz: dd88ab7d48335f79c874005ea50ee76a6878af89cc3ebbb5333ade70059f084654c20ae83a2200d1d6c2730ced8e58859a4358c8934703f19fa2dfe5f29e766b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ### 1.0.2
2
+
3
+ * When used in combination with the `factory_bot_rails` gem (>= 6.0) we do not
4
+ force a `FactoryBot.reload` at Rails engine initialization as it breaks with
5
+ an `FactoryBot::DuplicateDefinitionError` (#14)
6
+
1
7
  ### 1.0.1
2
8
 
3
9
  * Added a retry logic to the FactoryBot reloading on the POST/create endpoint
@@ -40,6 +40,7 @@ Gem::Specification.new do |spec|
40
40
  spec.add_development_dependency 'appraisal', '~> 2.4'
41
41
  spec.add_development_dependency 'bundler', '~> 2.3'
42
42
  spec.add_development_dependency 'countless', '~> 1.1'
43
+ spec.add_development_dependency 'factory_bot_rails', '~> 6.2'
43
44
  spec.add_development_dependency 'guard-rspec', '~> 4.7'
44
45
  spec.add_development_dependency 'railties', '>= 5.2'
45
46
  spec.add_development_dependency 'rspec-rails', '~> 5.1'
@@ -7,11 +7,16 @@ module FactoryBot
7
7
  isolate_namespace FactoryBot::Instrumentation
8
8
 
9
9
  # Fill in some dynamic settings (application related)
10
- initializer 'factory_bot_instrumentation.config' do
11
- # Ensure the FactoryBot gem loads its factories to ensure they are
12
- # also available in the rails console and other places in the app
13
- # and not only via instrumentation frontend.
14
- FactoryBot.reload
10
+ initializer 'factory_bot_instrumentation.config' do |app|
11
+ # Ensure the FactoryBot gem loads its factories to ensure they are also
12
+ # available in the rails console and other places in the app and not
13
+ # only via instrumentation frontend. We skip this step as in
14
+ # combination with the +factory_bot_rails+ gem (>=6.0) the FactoryBot
15
+ # initializing occurs after the Rails application initializing, which
16
+ # leads to +FactoryBot::DuplicateDefinitionError+s.
17
+ initializer_names = app.initializers.map(&:name).map(&:to_s)
18
+ FactoryBot.reload \
19
+ if initializer_names.grep(/^factory_bot\./).count.zero?
15
20
 
16
21
  FactoryBot::Instrumentation.configure do |conf|
17
22
  # Set the application name dynamically
@@ -4,7 +4,7 @@ module FactoryBot
4
4
  # The gem version details.
5
5
  module Instrumentation
6
6
  # The version of the +factory_bot_instrumentation+ gem
7
- VERSION = '1.0.1'
7
+ VERSION = '1.0.2'
8
8
 
9
9
  class << self
10
10
  # Returns the version of gem as a string.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: factory_bot_instrumentation
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hermann Mayer
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '1.1'
97
+ - !ruby/object:Gem::Dependency
98
+ name: factory_bot_rails
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '6.2'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '6.2'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: guard-rspec
99
113
  requirement: !ruby/object:Gem::Requirement