fabrication 2.25.0 → 2.26.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1fa068a804c3a1374125c849657ee519ce7b08662ea994c3a9b357e1a74ce56c
|
4
|
+
data.tar.gz: 94031042eb41382a40aa39877abfadaa3664893e3d5c94946a1022a483b68d93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5ca378dd07da6affa590ba5a798e91d2261228af1d016066c6fb82e686f9a8d6fb397e5080ba819a26884e2d17479c408de0ae88e83607c8a57f54c997bd78c
|
7
|
+
data.tar.gz: 496347a6e1279a2a62c10e6b77e9e4a9a2fc5ab32b6654b62fdb2a330b33cb8fe8712a56059540694d16bb221ef1ef1131e2f982f76880b3e9eb6721dc5efa02
|
data/lib/fabricate.rb
CHANGED
@@ -24,13 +24,19 @@ class Fabricate
|
|
24
24
|
def self.build(name, overrides = {}, &block)
|
25
25
|
fail_if_initializing(name)
|
26
26
|
schematic(name).build(overrides, &block).tap do |object|
|
27
|
-
Fabrication::
|
27
|
+
Fabrication::Config.notifiers.each do |notifier|
|
28
|
+
notifier.call(name, object)
|
29
|
+
end
|
28
30
|
end
|
29
31
|
end
|
30
32
|
|
31
33
|
def self.create(name, overrides = {}, &block)
|
32
34
|
fail_if_initializing(name)
|
33
|
-
schematic(name).fabricate(overrides, &block)
|
35
|
+
schematic(name).fabricate(overrides, &block).tap do |object|
|
36
|
+
Fabrication::Config.notifiers.each do |notifier|
|
37
|
+
notifier.call(name, object)
|
38
|
+
end
|
39
|
+
end
|
34
40
|
end
|
35
41
|
|
36
42
|
def self.sequence(name = Fabrication::Sequencer::DEFAULT, start = nil, &block)
|
data/lib/fabrication/config.rb
CHANGED
@@ -35,7 +35,7 @@ module Fabrication
|
|
35
35
|
self.fabricator_path = folders
|
36
36
|
end
|
37
37
|
|
38
|
-
attr_writer :sequence_start
|
38
|
+
attr_writer :sequence_start
|
39
39
|
|
40
40
|
def sequence_start
|
41
41
|
@sequence_start ||= 0
|
@@ -50,10 +50,6 @@ module Fabrication
|
|
50
50
|
end
|
51
51
|
alias path_prefixes path_prefix
|
52
52
|
|
53
|
-
def register_with_steps?
|
54
|
-
@register_with_steps ||= nil
|
55
|
-
end
|
56
|
-
|
57
53
|
def generators
|
58
54
|
@generators ||= []
|
59
55
|
end
|
@@ -69,5 +65,24 @@ module Fabrication
|
|
69
65
|
def recursion_limit=(limit)
|
70
66
|
@recursion_limit = limit
|
71
67
|
end
|
68
|
+
|
69
|
+
def register_with_steps=(value)
|
70
|
+
puts 'DEPRECATION WARNING: Fabrication::Config.register_with_steps has been ' \
|
71
|
+
'deprecated. Please regenerate your cucumber steps with `rails g fabrication:cucumber_steps'
|
72
|
+
|
73
|
+
return unless value
|
74
|
+
|
75
|
+
register_notifier do |name, object|
|
76
|
+
Fabrication::Cucumber::Fabrications[name] = object
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def notifiers
|
81
|
+
@notifiers ||= []
|
82
|
+
end
|
83
|
+
|
84
|
+
def register_notifier(&block)
|
85
|
+
notifiers.push(block)
|
86
|
+
end
|
72
87
|
end
|
73
88
|
end
|
data/lib/fabrication/version.rb
CHANGED
data/lib/fabrication.rb
CHANGED
@@ -64,9 +64,7 @@ def Fabricator(name, options = {}, &block)
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def Fabricate(name, overrides = {}, &block)
|
67
|
-
Fabricate.create(name, overrides, &block)
|
68
|
-
Fabrication::Cucumber::Fabrications[name] = object if Fabrication::Config.register_with_steps?
|
69
|
-
end
|
67
|
+
Fabricate.create(name, overrides, &block)
|
70
68
|
end
|
71
69
|
# rubocop:enable Naming/MethodName
|
72
70
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fabrication
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.26.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Elliott
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Fabrication is an object generation framework for ActiveRecord, Mongoid,
|
14
14
|
DataMapper, Sequel, or any other Ruby object.
|