faker_maker 1.1.10 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1b3913f6f52a9519d1b25770428e7a4789845c9115f9b34ffac7347141d80c6c
4
- data.tar.gz: edf41922350fa0ea7a28561822ed834edddd724ac82f6ecb6bb89fdba18d5c4a
3
+ metadata.gz: '085b4651f6fd8681a1544f7fcc1c3ec05709f2709c701268c16efaf09b4ce06d'
4
+ data.tar.gz: bdabf0075d7453c39a24554c659e859781c15b1fc7880b5115134e38438fe756
5
5
  SHA512:
6
- metadata.gz: d3d6f954a378a1198f4523e188208059b2d2859b2af0ab0e2d89a00373ee03c5a1baca7289b8c0538bee03652963b361450435efa13dfab7dbd84f68945c6c6a
7
- data.tar.gz: ea8fed86a1715e39245e5459f70c293b02febf76c4b806858ebddd0d4879dac7d07caadd565d32396165747d355d7099c428258c48526d72e0586114342b86b2
6
+ metadata.gz: 19b799c28b8409657e9f8abe28eaaa6dabf6caefc66055e894c843994a9a8b1f66aedc35a356a0da5e620bd8d12cd25dc5cf077393e4dea80f17b9d1cb048c48
7
+ data.tar.gz: 3a288478c6afff7c15a3246bc445fcad61a93679fbe345503bcb782d254eb08ea72a825b794699dfb18dad7a1b0522ee5d6a5beb24452b476bd8f365a6449c67
@@ -16,7 +16,7 @@ For instance:
16
16
 
17
17
  ```ruby
18
18
  FakerMaker.factory :user do
19
- before_build do
19
+ before_build do |instance, factory|
20
20
  puts 'Building an instance of User'
21
21
  end
22
22
 
@@ -24,10 +24,8 @@ FakerMaker.factory :user do
24
24
  email {'patsy@fabulous.co.uk'}
25
25
  admin {false}
26
26
 
27
- after_build do
28
- puts "Built an instance of User (#{faker_maker_factory.instance.name})"
27
+ after_build do |instance, factory|
28
+ puts "Built an instance of User (#{instance.name})"
29
29
  end
30
30
  end
31
31
  ```
32
-
33
- Access to the factory object is through the `faker_maker_factory` method. The instance under construction is available through the `faker_maker_factory.instance` method.
@@ -103,7 +103,7 @@ module FakerMaker
103
103
  end
104
104
 
105
105
  def find_attribute( name = '' )
106
- attributes.filter { |a| [a.name, a.translation].include? name }.first
106
+ attributes.filter { |a| [a.name, a.translation, @naming_strategy&.name(name)].include? name }.first
107
107
  end
108
108
 
109
109
  protected
@@ -5,11 +5,11 @@ module FakerMaker
5
5
  # Lifecycle hooks which can be called during the building of an instance
6
6
  module DefinitionProxy
7
7
  def before_build(&block)
8
- @factory.define_singleton_method(:before_build) { block.call }
8
+ @factory.define_singleton_method(:before_build) { yield(self.instance, self) }
9
9
  end
10
10
 
11
11
  def after_build(&block)
12
- @factory.define_singleton_method(:after_build) { block.call }
12
+ @factory.define_singleton_method(:after_build) { yield(self.instance, self) }
13
13
  end
14
14
  end
15
15
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FakerMaker
4
- VERSION = '1.1.10'
4
+ VERSION = '1.2.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faker_maker
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.10
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nigel Brookes-Thomas
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-28 00:00:00.000000000 Z
11
+ date: 2021-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport