factory_bot 5.0.0.rc1 → 5.0.0.rc2
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.rb +2 -1
- data/lib/factory_bot/syntax/methods.rb +29 -6
- data/lib/factory_bot/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc3b2bada56beb012327c9ca4a0586d69f47e0b5a161b4dc0dd7b2b19c83dae5
|
4
|
+
data.tar.gz: 7f83803f5a6eaad37b25ef5a7af9a6956dbad5c8172423de2e35ce2b627158f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c04cc2fe18153881e7da1bbc1c86f7874df6cbb0ab2769d661e198f764c27e5cb1afc59d5485d73402b73f8e524f46d066bb53ca78c648dc396739c91c285587
|
7
|
+
data.tar.gz: f2a50f8a36f7edab7c74ab654a8ddaec5c0fe2fd2e094e0d9622471043d7da085e80f225ec6c42864a20fbaf371b2fce391c62e39637101f858228902245b2a7
|
data/lib/factory_bot.rb
CHANGED
@@ -57,7 +57,8 @@ module FactoryBot
|
|
57
57
|
@configuration = nil
|
58
58
|
end
|
59
59
|
|
60
|
-
mattr_accessor :use_parent_strategy, instance_accessor: false
|
60
|
+
mattr_accessor :use_parent_strategy, instance_accessor: false
|
61
|
+
self.use_parent_strategy = true
|
61
62
|
|
62
63
|
# Look for errors in factories and (optionally) their traits.
|
63
64
|
# Parameters:
|
@@ -2,8 +2,8 @@ module FactoryBot
|
|
2
2
|
module Syntax
|
3
3
|
## This module is a container for all strategy methods provided by
|
4
4
|
## FactoryBot. This includes all the default strategies provided ({Methods#build},
|
5
|
-
## {Methods#create}, {Methods#build_stubbed}, and {Methods#attributes_for}), as
|
6
|
-
## the complementary *_list methods.
|
5
|
+
## {Methods#create}, {Methods#build_stubbed}, and {Methods#attributes_for}), as
|
6
|
+
## well as the complementary *_list and *_pair methods.
|
7
7
|
## @example singular factory execution
|
8
8
|
## # basic use case
|
9
9
|
## build(:completed_order)
|
@@ -51,22 +51,38 @@ module FactoryBot
|
|
51
51
|
# Generates a hash of attributes for a registered factory by name.
|
52
52
|
# @return [Hash] hash of attributes for the factory
|
53
53
|
|
54
|
-
# @!method build_list(name, amount, *traits_and_overrides)
|
54
|
+
# @!method build_list(name, amount, *traits_and_overrides, &block)
|
55
55
|
# (see #strategy_method_list)
|
56
56
|
# @return [Array] array of built objects defined by the factory
|
57
57
|
|
58
|
-
# @!method create_list(name, amount, *traits_and_overrides)
|
58
|
+
# @!method create_list(name, amount, *traits_and_overrides, &block)
|
59
59
|
# (see #strategy_method_list)
|
60
60
|
# @return [Array] array of created objects defined by the factory
|
61
61
|
|
62
|
-
# @!method build_stubbed_list(name, amount, *traits_and_overrides)
|
62
|
+
# @!method build_stubbed_list(name, amount, *traits_and_overrides, &block)
|
63
63
|
# (see #strategy_method_list)
|
64
64
|
# @return [Array] array of stubbed objects defined by the factory
|
65
65
|
|
66
|
-
# @!method attributes_for_list(name, amount, *traits_and_overrides)
|
66
|
+
# @!method attributes_for_list(name, amount, *traits_and_overrides, &block)
|
67
67
|
# (see #strategy_method_list)
|
68
68
|
# @return [Array<Hash>] array of attribute hashes for the factory
|
69
69
|
|
70
|
+
# @!method build_pair(name, *traits_and_overrides, &block)
|
71
|
+
# (see #strategy_method_pair)
|
72
|
+
# @return [Array] pair of built objects defined by the factory
|
73
|
+
|
74
|
+
# @!method create_pair(name, *traits_and_overrides, &block)
|
75
|
+
# (see #strategy_method_pair)
|
76
|
+
# @return [Array] pair of created objects defined by the factory
|
77
|
+
|
78
|
+
# @!method build_stubbed_pair(name, *traits_and_overrides, &block)
|
79
|
+
# (see #strategy_method_pair)
|
80
|
+
# @return [Array] pair of stubbed objects defined by the factory
|
81
|
+
|
82
|
+
# @!method attributes_for_pair(name, *traits_and_overrides, &block)
|
83
|
+
# (see #strategy_method_pair)
|
84
|
+
# @return [Array<Hash>] pair of attribute hashes for the factory
|
85
|
+
|
70
86
|
# @!method strategy_method
|
71
87
|
# @!visibility private
|
72
88
|
# @param [Symbol] name the name of the factory to build
|
@@ -78,6 +94,13 @@ module FactoryBot
|
|
78
94
|
# @param [Symbol] name the name of the factory to execute
|
79
95
|
# @param [Integer] amount the number of instances to execute
|
80
96
|
# @param [Array<Symbol, Symbol, Hash>] traits_and_overrides splat args traits and a hash of overrides
|
97
|
+
# @param [Proc] block block to be executed
|
98
|
+
|
99
|
+
# @!method strategy_method_pair
|
100
|
+
# @!visibility private
|
101
|
+
# @param [Symbol] name the name of the factory to execute
|
102
|
+
# @param [Array<Symbol, Symbol, Hash>] traits_and_overrides splat args traits and a hash of overrides
|
103
|
+
# @param [Proc] block block to be executed
|
81
104
|
|
82
105
|
# Generates and returns the next value in a sequence.
|
83
106
|
#
|
data/lib/factory_bot/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: factory_bot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.0.
|
4
|
+
version: 5.0.0.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Clayton
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-01-
|
12
|
+
date: 2019-01-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|