factory_bot 6.5.1 → 6.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 71c90d06521a4d6e1bbd613bdc1494919b2acde4117153524a11d8fbea53301c
4
- data.tar.gz: 7e19bf127cf040c9f59fea525894019358e0502de695cf5957ac5eb91280e1d1
3
+ metadata.gz: ffc4ecdfaad4faf3f66a090e8a67f73d399e6df92245cf77907b6483cc168b6d
4
+ data.tar.gz: f0445ea4b16381a1126775e0b127b3c4afd34ac23e9b0dd19930b84e267f8866
5
5
  SHA512:
6
- metadata.gz: ff1b56b976b423b91d8f633fdb0d1ed2d13b5c75665547adbb4d6f1d90b15aff35459dcb2fd6479e6dccdfd98ce3a9bd2a13b1ced002704fb84c39e2d5ebb3f3
7
- data.tar.gz: dfc7713d8511e0723ab41da77257c901ca2d5abdf04b21b8f81332bd4f6e6568d403a68fc7831529ab8cbed531c25bc068458ee28fb2b1d7f0b7ebeafda02a3a
6
+ metadata.gz: 7b9e9db68e4fc0a222b6229c75391d23bc5014dfadd2e356bc74f037537749c60ee52f0cf4038bff5e5ba7488e9f4623db13a3b0b8d6f6a91fed1c41b0d5faac
7
+ data.tar.gz: d8002e39646803600784bb64cd1e611ecc0f056e2538a5496ca63d9804cb847582508b7558531fc5a15442077696de17316a7120abba8c1cbbe93cda71aa99b8
data/GETTING_STARTED.md CHANGED
@@ -219,6 +219,26 @@ It is also possible to explicitly specify the class:
219
219
  factory :admin, class: "User"
220
220
  ```
221
221
 
222
+ Explicit specification of the class, _with the full namespace_, is necessary when defining factories for classes nested within other modules or classes:
223
+
224
+ ```ruby
225
+ # foo/bar.rb
226
+ module Foo
227
+ class Bar
228
+ ...
229
+ end
230
+ end
231
+
232
+ # factories.rb
233
+ FactoryBot.define do
234
+ factory :bar, class: 'Foo::Bar' do
235
+ ...
236
+ end
237
+ end
238
+ ```
239
+
240
+ If the full namespace is not provided in the `factory` statement, you will receive a `NameError: uninitialized constant Bar` error.
241
+
222
242
  You can pass a constant as well, if the constant is available (note that this
223
243
  can cause test performance problems in large Rails applications, since
224
244
  referring to the constant will cause it to be eagerly loaded).
@@ -255,10 +275,12 @@ Factories can be defined anywhere, but will be automatically loaded after
255
275
  calling `FactoryBot.find_definitions` if factories are defined in files at the
256
276
  following locations:
257
277
 
278
+ factories.rb
279
+ factories/**/*.rb
258
280
  test/factories.rb
281
+ test/factories/**/*.rb
259
282
  spec/factories.rb
260
- test/factories/*.rb
261
- spec/factories/*.rb
283
+ spec/factories/**/*.rb
262
284
 
263
285
  ### Static Attributes
264
286