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 +4 -4
- data/lib/factory_bot_cache.rb +6 -3
- data/lib/factory_bot_cache/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 925ad510b41fffbe7c780342dc91fec9204f68dd
|
4
|
+
data.tar.gz: cee031fc8222243eaa1d62260dddefead04144a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3469fd03fb6ec953cbb2a73152ada3a8767d0ebe07dbc9ba8ff8e4cf6696e1b1f30113ebb9d6d4c3d5a0b79e7b7a71d63f8625564572e625e3d83d1e58fc65ae
|
7
|
+
data.tar.gz: 4ce73518eedbbb20bb85c713bfdb2aad93265127a1ac086fe4b2b34ed467e2d385703c51691ca39d49dedd1f4a3ce04fee09f25d82fae2b244c29663fef54f1d
|
data/lib/factory_bot_cache.rb
CHANGED
@@ -9,8 +9,10 @@ module FactoryBotCache
|
|
9
9
|
@caches = nil
|
10
10
|
end
|
11
11
|
|
12
|
-
def
|
13
|
-
|
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
|
-
|
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
|
|
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.
|
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
|
+
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.
|
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.
|