factory_bot_cache 0.1.0 → 0.1.1

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
  SHA1:
3
- metadata.gz: f08f94a68835094271b6c7993a0f325e9822ae01
4
- data.tar.gz: 7100ea7a76ba3d512e110ec6ebc6e05f22f95a90
3
+ metadata.gz: 925ad510b41fffbe7c780342dc91fec9204f68dd
4
+ data.tar.gz: cee031fc8222243eaa1d62260dddefead04144a0
5
5
  SHA512:
6
- metadata.gz: 275ac96d7ed6568a16c267b9e5edabb174b8cdb92c9034291e280667f5b3e74ad4b8736a0b309c726fd64367f2863c71d20faaa2d8c0d2d3d094326a967cc8bc
7
- data.tar.gz: eb0d1a0a8840a0a59ace89bdf0dc83abfb6f44d11645eebe16097e3c0f346a0030aaf70c2695062c2c3d00a9c4ce2d8e556c2f7b2403fe0ded5117d2e258f217
6
+ metadata.gz: 3469fd03fb6ec953cbb2a73152ada3a8767d0ebe07dbc9ba8ff8e4cf6696e1b1f30113ebb9d6d4c3d5a0b79e7b7a71d63f8625564572e625e3d83d1e58fc65ae
7
+ data.tar.gz: 4ce73518eedbbb20bb85c713bfdb2aad93265127a1ac086fe4b2b34ed467e2d385703c51691ca39d49dedd1f4a3ce04fee09f25d82fae2b244c29663fef54f1d
@@ -9,8 +9,10 @@ module FactoryBotCache
9
9
  @caches = nil
10
10
  end
11
11
 
12
- def name_for(base_name, key)
13
- "#{base_name}_#{key}"
12
+ def naming_rules
13
+ @naming_rules ||= Hash.new do |hash, base_name|
14
+ hash[base_name] = ->(key){ "#{base_name}_#{key}" }
15
+ end
14
16
  end
15
17
 
16
18
  def caches
@@ -19,7 +21,8 @@ module FactoryBotCache
19
21
 
20
22
  def of(base_name)
21
23
  caches[base_name.to_sym] ||= Hash.new do |hash, key|
22
- hash[key] = FactoryBot.create( name_for(base_name, key) )
24
+ naming_rule = naming_rules[base_name.to_sym]
25
+ hash[key] = FactoryBot.create( naming_rule[key] )
23
26
  end
24
27
  end
25
28
 
@@ -1,3 +1,3 @@
1
1
  module FactoryBotCache
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: factory_bot_cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - akm
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-30 00:00:00.000000000 Z
11
+ date: 2017-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: factory_bot
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
106
  version: '0'
107
107
  requirements: []
108
108
  rubyforge_project:
109
- rubygems_version: 2.6.13
109
+ rubygems_version: 2.5.2
110
110
  signing_key:
111
111
  specification_version: 4
112
112
  summary: Help to define complicated objects with factory_bot.