faker_maker 5.0.0 → 5.0.1

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: 1df64c4c071bb9c9623874c2f266ac6f9dfba54b2ed0f501f58131353833a59e
4
+ data.tar.gz: 6403c0f1990d048fa124564061048dd86b7d4b28b01a9658b44042cc22886a02
5
5
  SHA512:
6
- metadata.gz: 3017220049faf7e81b824bf3250cae33cbb9094c76e9016f1f49931299dd2df4b572a1be740b5e8fd39afa4166bdb5fd49c21c81a6591b67b51b3647764ec6d0
7
- data.tar.gz: d809da52da4aa002cd0a06fa5d479df8da9e3a8b1b569c484e411c8aef53c648050db60f13a186403e383f3de9197c3773f0e0cb5701d9aa9e1d5427c28ee9aa
6
+ metadata.gz: 3d404f4f32d20a046584921e852d45a3b7fe03d2bf7cd955c8cfcfdbd48d29b5c3e9e4341dbe97d87d9c625a75d7d070e82d4d61dad8a4223cb570d3ecf0aff2
7
+ data.tar.gz: e2758709d5f3fac765e34d3216500125420edd6dd89f53143c0329d77a87cf797370fc9b8394ce06db9532aba46ef50ff13beb3e17e631e6e651fa4ba984a2a0
@@ -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?
@@ -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.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
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.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nigel Brookes-Thomas