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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '09021d0ce98cccbc475dccc29d71e75d6554eeeba2589cae32ba3f1b455146fb'
4
- data.tar.gz: 2694b0fece8d0853b86cc98f40f175b46a3c6671585c8150462dee2991b9d346
3
+ metadata.gz: fdb0b495c6d3cbcfcb4f833e8446bd8cb3a3119643e2281e09000e751027000e
4
+ data.tar.gz: bc8465e73262915db5807e48c523de100d33169e82d5529051725b10ea10bc9a
5
5
  SHA512:
6
- metadata.gz: 3017220049faf7e81b824bf3250cae33cbb9094c76e9016f1f49931299dd2df4b572a1be740b5e8fd39afa4166bdb5fd49c21c81a6591b67b51b3647764ec6d0
7
- data.tar.gz: d809da52da4aa002cd0a06fa5d479df8da9e3a8b1b569c484e411c8aef53c648050db60f13a186403e383f3de9197c3773f0e0cb5701d9aa9e1d5427c28ee9aa
6
+ metadata.gz: 8c95a76906f98b03896be2e1b1b99196d3b745eccfcb84fde9c00000e6a4d32ce566491e88af6ddbcd5b0ab48dbeb3ad0291527db702913db6364ce5afdf511f
7
+ data.tar.gz: 3ea216e352581c7a33b7741862bf0b2f232b4b5cafda4521dc11756b92460d628e3ee943dd538877925854b9ef75c0f903798a102e274db73d85f389abcf4f26
@@ -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 !attr.embedded_factories? && overridden_value?( attr, attr_override_values )
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| pp f.attributes.map(&:name) }
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
- embedded_factory&.build(attributes:, chaos:)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FakerMaker
4
- VERSION = '5.0.0'
4
+ VERSION = '5.0.2'
5
5
  end
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.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: 1980-01-02 00:00:00.000000000 Z
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.3
277
+ rubygems_version: 4.0.10
278
278
  specification_version: 4
279
279
  summary: FakerMaker bakes fakes.
280
280
  test_files: []