factory_bot 6.5.4 → 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 +4 -4
- data/GETTING_STARTED.md +20 -0
- data/NEWS.md +412 -334
- data/lib/factory_bot/attribute_assigner.rb +25 -8
- data/lib/factory_bot/callbacks_observer.rb +19 -1
- data/lib/factory_bot/evaluator.rb +9 -3
- data/lib/factory_bot/factory.rb +6 -1
- data/lib/factory_bot/registry.rb +1 -1
- data/lib/factory_bot/sequence.rb +22 -8
- data/lib/factory_bot/strategy/build.rb +2 -0
- data/lib/factory_bot/strategy/create.rb +2 -0
- data/lib/factory_bot/syntax/methods.rb +4 -6
- data/lib/factory_bot/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffc4ecdfaad4faf3f66a090e8a67f73d399e6df92245cf77907b6483cc168b6d
|
4
|
+
data.tar.gz: f0445ea4b16381a1126775e0b127b3c4afd34ac23e9b0dd19930b84e267f8866
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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).
|