faker_maker 5.0.0 → 5.0.2
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/lib/faker_maker/factory.rb +9 -4
- data/lib/faker_maker/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: fdb0b495c6d3cbcfcb4f833e8446bd8cb3a3119643e2281e09000e751027000e
|
|
4
|
+
data.tar.gz: bc8465e73262915db5807e48c523de100d33169e82d5529051725b10ea10bc9a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8c95a76906f98b03896be2e1b1b99196d3b745eccfcb84fde9c00000e6a4d32ce566491e88af6ddbcd5b0ab48dbeb3ad0291527db702913db6364ce5afdf511f
|
|
7
|
+
data.tar.gz: 3ea216e352581c7a33b7741862bf0b2f232b4b5cafda4521dc11756b92460d628e3ee943dd538877925854b9ef75c0f903798a102e274db73d85f389abcf4f26
|
data/lib/faker_maker/factory.rb
CHANGED
|
@@ -237,7 +237,9 @@ module FakerMaker
|
|
|
237
237
|
|
|
238
238
|
def assert_only_known_and_optional_attributes_for_chaos( chaos_attr_values )
|
|
239
239
|
chaos_attr_values = chaos_attr_values.map(&:to_sym)
|
|
240
|
-
unknown_attrs = chaos_attr_values - attribute_names
|
|
240
|
+
unknown_attrs = chaos_attr_values - attribute_names.flat_map do |item|
|
|
241
|
+
item.is_a?(Hash) ? item.keys : item
|
|
242
|
+
end
|
|
241
243
|
issue = "Can't build an instance of '#{class_name}' " \
|
|
242
244
|
"setting '#{unknown_attrs.join( ', ' )}', no such attribute(s)"
|
|
243
245
|
raise FakerMaker::NoSuchAttributeError, issue unless unknown_attrs.empty?
|
|
@@ -253,7 +255,7 @@ module FakerMaker
|
|
|
253
255
|
end
|
|
254
256
|
|
|
255
257
|
def value_for_attribute( instance, attr, attr_override_values, chaos: false )
|
|
256
|
-
if
|
|
258
|
+
if overridden_value?( attr, attr_override_values ) && !attr_override_values[attr.name].is_a?( Hash )
|
|
257
259
|
attr_override_values[attr.name]
|
|
258
260
|
elsif attr.array?
|
|
259
261
|
[].tap do |a|
|
|
@@ -280,12 +282,15 @@ module FakerMaker
|
|
|
280
282
|
attributes = attr
|
|
281
283
|
.embedded_factories
|
|
282
284
|
.reject { |e| e == embedded_factory }
|
|
283
|
-
.flat_map { |f|
|
|
285
|
+
.flat_map { |f| f.attributes(include_embeddings: false).map(&:name) }
|
|
284
286
|
.then { |excl| attributes.delete_if { |k, _v| excl.include?(k) } }
|
|
285
287
|
|
|
286
288
|
# The object that is being manufactured by the factory.
|
|
287
289
|
# If an embedded factory name is provided, it builds the object using FakerMaker.
|
|
288
|
-
|
|
290
|
+
# Chaos is converted to a boolean so that child factories inherit random chaos
|
|
291
|
+
# behaviour without receiving attribute names meant for the parent.
|
|
292
|
+
embedded_chaos = chaos.is_a?(Array) || chaos.is_a?(String) || chaos.is_a?(Symbol) ? true : chaos
|
|
293
|
+
embedded_factory&.build(attributes:, chaos: embedded_chaos)
|
|
289
294
|
end
|
|
290
295
|
|
|
291
296
|
def instantiate
|
data/lib/faker_maker/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: faker_maker
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.0.
|
|
4
|
+
version: 5.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nigel Brookes-Thomas
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 2026-07-22 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: activesupport
|
|
@@ -274,7 +274,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
274
274
|
- !ruby/object:Gem::Version
|
|
275
275
|
version: '0'
|
|
276
276
|
requirements: []
|
|
277
|
-
rubygems_version: 4.0.
|
|
277
|
+
rubygems_version: 4.0.10
|
|
278
278
|
specification_version: 4
|
|
279
279
|
summary: FakerMaker bakes fakes.
|
|
280
280
|
test_files: []
|