tiny-lite-mod 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/factory_bot-6.6.0/CONTRIBUTING.md +105 -0
- data/factory_bot-6.6.0/GETTING_STARTED.md +2203 -0
- data/factory_bot-6.6.0/LICENSE +19 -0
- data/factory_bot-6.6.0/NAME.md +18 -0
- data/factory_bot-6.6.0/NEWS.md +607 -0
- data/factory_bot-6.6.0/README.md +99 -0
- data/factory_bot-6.6.0/lib/factory_bot/aliases.rb +18 -0
- data/factory_bot-6.6.0/lib/factory_bot/attribute/association.rb +27 -0
- data/factory_bot-6.6.0/lib/factory_bot/attribute/dynamic.rb +25 -0
- data/factory_bot-6.6.0/lib/factory_bot/attribute/sequence.rb +16 -0
- data/factory_bot-6.6.0/lib/factory_bot/attribute.rb +27 -0
- data/factory_bot-6.6.0/lib/factory_bot/attribute_assigner.rb +168 -0
- data/factory_bot-6.6.0/lib/factory_bot/attribute_list.rb +68 -0
- data/factory_bot-6.6.0/lib/factory_bot/callback.rb +33 -0
- data/factory_bot-6.6.0/lib/factory_bot/callbacks_observer.rb +39 -0
- data/factory_bot-6.6.0/lib/factory_bot/configuration.rb +33 -0
- data/factory_bot-6.6.0/lib/factory_bot/declaration/association.rb +58 -0
- data/factory_bot-6.6.0/lib/factory_bot/declaration/dynamic.rb +28 -0
- data/factory_bot-6.6.0/lib/factory_bot/declaration/implicit.rb +38 -0
- data/factory_bot-6.6.0/lib/factory_bot/declaration.rb +23 -0
- data/factory_bot-6.6.0/lib/factory_bot/declaration_list.rb +49 -0
- data/factory_bot-6.6.0/lib/factory_bot/decorator/attribute_hash.rb +16 -0
- data/factory_bot-6.6.0/lib/factory_bot/decorator/disallows_duplicates_registry.rb +13 -0
- data/factory_bot-6.6.0/lib/factory_bot/decorator/invocation_tracker.rb +20 -0
- data/factory_bot-6.6.0/lib/factory_bot/decorator/new_constructor.rb +12 -0
- data/factory_bot-6.6.0/lib/factory_bot/decorator.rb +25 -0
- data/factory_bot-6.6.0/lib/factory_bot/definition.rb +210 -0
- data/factory_bot-6.6.0/lib/factory_bot/definition_hierarchy.rb +38 -0
- data/factory_bot-6.6.0/lib/factory_bot/definition_proxy.rb +269 -0
- data/factory_bot-6.6.0/lib/factory_bot/enum.rb +27 -0
- data/factory_bot-6.6.0/lib/factory_bot/errors.rb +28 -0
- data/factory_bot-6.6.0/lib/factory_bot/evaluation.rb +23 -0
- data/factory_bot-6.6.0/lib/factory_bot/evaluator.rb +86 -0
- data/factory_bot-6.6.0/lib/factory_bot/evaluator_class_definer.rb +20 -0
- data/factory_bot-6.6.0/lib/factory_bot/factory.rb +178 -0
- data/factory_bot-6.6.0/lib/factory_bot/factory_runner.rb +35 -0
- data/factory_bot-6.6.0/lib/factory_bot/find_definitions.rb +25 -0
- data/factory_bot-6.6.0/lib/factory_bot/internal.rb +124 -0
- data/factory_bot-6.6.0/lib/factory_bot/linter.rb +121 -0
- data/factory_bot-6.6.0/lib/factory_bot/null_factory.rb +27 -0
- data/factory_bot-6.6.0/lib/factory_bot/null_object.rb +20 -0
- data/factory_bot-6.6.0/lib/factory_bot/registry.rb +59 -0
- data/factory_bot-6.6.0/lib/factory_bot/reload.rb +7 -0
- data/factory_bot-6.6.0/lib/factory_bot/sequence.rb +197 -0
- data/factory_bot-6.6.0/lib/factory_bot/strategy/attributes_for.rb +17 -0
- data/factory_bot-6.6.0/lib/factory_bot/strategy/build.rb +21 -0
- data/factory_bot-6.6.0/lib/factory_bot/strategy/create.rb +24 -0
- data/factory_bot-6.6.0/lib/factory_bot/strategy/null.rb +15 -0
- data/factory_bot-6.6.0/lib/factory_bot/strategy/stub.rb +129 -0
- data/factory_bot-6.6.0/lib/factory_bot/strategy.rb +15 -0
- data/factory_bot-6.6.0/lib/factory_bot/strategy_syntax_method_registrar.rb +65 -0
- data/factory_bot-6.6.0/lib/factory_bot/syntax/default.rb +64 -0
- data/factory_bot-6.6.0/lib/factory_bot/syntax/methods.rb +181 -0
- data/factory_bot-6.6.0/lib/factory_bot/syntax.rb +7 -0
- data/factory_bot-6.6.0/lib/factory_bot/syntax_runner.rb +6 -0
- data/factory_bot-6.6.0/lib/factory_bot/trait.rb +39 -0
- data/factory_bot-6.6.0/lib/factory_bot/uri_manager.rb +63 -0
- data/factory_bot-6.6.0/lib/factory_bot/version.rb +3 -0
- data/factory_bot-6.6.0/lib/factory_bot.rb +117 -0
- data/tiny-lite-mod.gemspec +12 -0
- metadata +101 -0
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
module FactoryBot
|
|
2
|
+
module Syntax
|
|
3
|
+
## This module is a container for all strategy methods provided by
|
|
4
|
+
## FactoryBot. This includes all the default strategies provided ({Methods#build},
|
|
5
|
+
## {Methods#create}, {Methods#build_stubbed}, and {Methods#attributes_for}), as
|
|
6
|
+
## well as the complementary *_list and *_pair methods.
|
|
7
|
+
## @example singular factory execution
|
|
8
|
+
## # basic use case
|
|
9
|
+
## build(:completed_order)
|
|
10
|
+
##
|
|
11
|
+
## # factory yielding its result to a block
|
|
12
|
+
## create(:post) do |post|
|
|
13
|
+
## create(:comment, post: post)
|
|
14
|
+
## end
|
|
15
|
+
##
|
|
16
|
+
## # factory with attribute override
|
|
17
|
+
## attributes_for(:post, title: "I love Ruby!")
|
|
18
|
+
##
|
|
19
|
+
## # factory with traits and attribute override
|
|
20
|
+
## build_stubbed(:user, :admin, :male, name: "John Doe")
|
|
21
|
+
##
|
|
22
|
+
## @example multiple factory execution
|
|
23
|
+
## # basic use case
|
|
24
|
+
## build_list(:completed_order, 2)
|
|
25
|
+
## create_list(:completed_order, 2)
|
|
26
|
+
##
|
|
27
|
+
## # factory with attribute override
|
|
28
|
+
## attributes_for_list(:post, 4, title: "I love Ruby!")
|
|
29
|
+
##
|
|
30
|
+
## # factory with traits and attribute override
|
|
31
|
+
## build_stubbed_list(:user, 15, :admin, :male, name: "John Doe")
|
|
32
|
+
module Methods
|
|
33
|
+
# @!parse FactoryBot::Internal.register_default_strategies
|
|
34
|
+
# @!method build(name, *traits_and_overrides, &block)
|
|
35
|
+
# (see #strategy_method)
|
|
36
|
+
# Builds a registered factory by name.
|
|
37
|
+
# @return [Object] instantiated object defined by the factory
|
|
38
|
+
|
|
39
|
+
# @!method create(name, *traits_and_overrides, &block)
|
|
40
|
+
# (see #strategy_method)
|
|
41
|
+
# Creates a registered factory by name.
|
|
42
|
+
# @return [Object] instantiated object defined by the factory
|
|
43
|
+
|
|
44
|
+
# @!method build_stubbed(name, *traits_and_overrides, &block)
|
|
45
|
+
# (see #strategy_method)
|
|
46
|
+
# Builds a stubbed registered factory by name.
|
|
47
|
+
# @return [Object] instantiated object defined by the factory
|
|
48
|
+
|
|
49
|
+
# @!method attributes_for(name, *traits_and_overrides, &block)
|
|
50
|
+
# (see #strategy_method)
|
|
51
|
+
# Generates a hash of attributes for a registered factory by name.
|
|
52
|
+
# @return [Hash] hash of attributes for the factory
|
|
53
|
+
|
|
54
|
+
# @!method build_list(name, amount, *traits_and_overrides, &block)
|
|
55
|
+
# (see #strategy_method_list)
|
|
56
|
+
# @return [Array] array of built objects defined by the factory
|
|
57
|
+
|
|
58
|
+
# @!method create_list(name, amount, *traits_and_overrides, &block)
|
|
59
|
+
# (see #strategy_method_list)
|
|
60
|
+
# @return [Array] array of created objects defined by the factory
|
|
61
|
+
|
|
62
|
+
# @!method build_stubbed_list(name, amount, *traits_and_overrides, &block)
|
|
63
|
+
# (see #strategy_method_list)
|
|
64
|
+
# @return [Array] array of stubbed objects defined by the factory
|
|
65
|
+
|
|
66
|
+
# @!method attributes_for_list(name, amount, *traits_and_overrides, &block)
|
|
67
|
+
# (see #strategy_method_list)
|
|
68
|
+
# @return [Array<Hash>] array of attribute hashes for the factory
|
|
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
|
+
|
|
86
|
+
# @!method strategy_method(name, traits_and_overrides, &block)
|
|
87
|
+
# @!visibility private
|
|
88
|
+
# @param [Symbol] name the name of the factory to build
|
|
89
|
+
# @param [Array<Symbol, Symbol, Hash>] traits_and_overrides splat args traits and a hash of overrides
|
|
90
|
+
# @param [Proc] block block to be executed
|
|
91
|
+
|
|
92
|
+
# @!method strategy_method_list(name, amount, traits_and_overrides, &block)
|
|
93
|
+
# @!visibility private
|
|
94
|
+
# @param [Symbol] name the name of the factory to execute
|
|
95
|
+
# @param [Integer] amount the number of instances to execute
|
|
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(name, traits_and_overrides, &block)
|
|
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
|
|
104
|
+
|
|
105
|
+
# Generates and returns the next value in a global or factory sequence.
|
|
106
|
+
#
|
|
107
|
+
# Arguments:
|
|
108
|
+
# context: (Array of Symbols)
|
|
109
|
+
# The definition context of the sequence, with the sequence name
|
|
110
|
+
# as the final entry
|
|
111
|
+
# scope: (object)(optional)
|
|
112
|
+
# The object the sequence should be evaluated within
|
|
113
|
+
#
|
|
114
|
+
# Returns:
|
|
115
|
+
# The next value in the sequence. (Object)
|
|
116
|
+
#
|
|
117
|
+
# Example:
|
|
118
|
+
# generate(:my_factory, :my_trair, :my_sequence)
|
|
119
|
+
#
|
|
120
|
+
def generate(*uri_parts, scope: nil)
|
|
121
|
+
uri = FactoryBot::UriManager.build_uri(uri_parts)
|
|
122
|
+
sequence = Sequence.find_by_uri(uri) ||
|
|
123
|
+
raise(KeyError,
|
|
124
|
+
"Sequence not registered: #{FactoryBot::UriManager.build_uri(uri_parts)}")
|
|
125
|
+
|
|
126
|
+
increment_sequence(sequence, scope: scope)
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# Generates and returns the list of values in a global or factory sequence.
|
|
130
|
+
#
|
|
131
|
+
# Arguments:
|
|
132
|
+
# uri_parts: (Array of Symbols)
|
|
133
|
+
# The definition context of the sequence, with the sequence name
|
|
134
|
+
# as the final entry
|
|
135
|
+
# scope: (object)(optional)
|
|
136
|
+
# The object the sequence should be evaluated within
|
|
137
|
+
#
|
|
138
|
+
# Returns:
|
|
139
|
+
# The next value in the sequence. (Object)
|
|
140
|
+
#
|
|
141
|
+
# Example:
|
|
142
|
+
# generate_list(:my_factory, :my_trair, :my_sequence, 5)
|
|
143
|
+
#
|
|
144
|
+
def generate_list(*uri_parts, count, scope: nil)
|
|
145
|
+
uri = FactoryBot::UriManager.build_uri(uri_parts)
|
|
146
|
+
sequence = Sequence.find_by_uri(uri) ||
|
|
147
|
+
raise(KeyError, "Sequence not registered: '#{uri}'")
|
|
148
|
+
|
|
149
|
+
(1..count).map do
|
|
150
|
+
increment_sequence(sequence, scope: scope)
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
# ======================================================================
|
|
155
|
+
# = PRIVATE
|
|
156
|
+
# ======================================================================
|
|
157
|
+
#
|
|
158
|
+
private
|
|
159
|
+
|
|
160
|
+
##
|
|
161
|
+
# Increments the given sequence and returns the value.
|
|
162
|
+
#
|
|
163
|
+
# Arguments:
|
|
164
|
+
# sequence:
|
|
165
|
+
# The sequence instance
|
|
166
|
+
# scope: (object)(optional)
|
|
167
|
+
# The object the sequence should be evaluated within
|
|
168
|
+
#
|
|
169
|
+
def increment_sequence(sequence, scope: nil)
|
|
170
|
+
value = sequence.next(scope)
|
|
171
|
+
|
|
172
|
+
raise if value.respond_to?(:start_with?) && value.start_with?("#<FactoryBot::Declaration")
|
|
173
|
+
|
|
174
|
+
value
|
|
175
|
+
rescue
|
|
176
|
+
raise ArgumentError, "Sequence '#{sequence.uri_manager.first}' failed to " \
|
|
177
|
+
"return a value. Perhaps it needs a scope to operate? (scope: <object>)"
|
|
178
|
+
end
|
|
179
|
+
end
|
|
180
|
+
end
|
|
181
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
module FactoryBot
|
|
2
|
+
# @api private
|
|
3
|
+
class Trait
|
|
4
|
+
attr_reader :name, :uid, :definition
|
|
5
|
+
|
|
6
|
+
delegate :add_callback, :declare_attribute, :to_create, :define_trait, :constructor,
|
|
7
|
+
:callbacks, :attributes, :klass, :klass=, to: :@definition
|
|
8
|
+
|
|
9
|
+
def initialize(name, **options, &block)
|
|
10
|
+
@name = name.to_s
|
|
11
|
+
@block = block
|
|
12
|
+
@uri_manager = FactoryBot::UriManager.new(names, paths: options[:uri_paths])
|
|
13
|
+
|
|
14
|
+
@definition = Definition.new(@name, uri_manager: @uri_manager)
|
|
15
|
+
proxy = FactoryBot::DefinitionProxy.new(@definition)
|
|
16
|
+
|
|
17
|
+
if block
|
|
18
|
+
proxy.instance_eval(&@block)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def clone
|
|
23
|
+
Trait.new(name, uri_paths: definition.uri_manager.paths, &block)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def names
|
|
27
|
+
[@name]
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def ==(other)
|
|
31
|
+
name == other.name &&
|
|
32
|
+
block == other.block
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
protected
|
|
36
|
+
|
|
37
|
+
attr_reader :block
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
module FactoryBot
|
|
2
|
+
# @api private
|
|
3
|
+
class UriManager
|
|
4
|
+
attr_reader :endpoints, :paths, :uri_list
|
|
5
|
+
|
|
6
|
+
delegate :size, :any?, :empty?, :each?, :include?, :first, to: :@uri_list
|
|
7
|
+
delegate :build_uri, to: :class
|
|
8
|
+
|
|
9
|
+
# Concatenate the parts, sripping leading/following slashes
|
|
10
|
+
# and returning a Symbolized String or nil.
|
|
11
|
+
#
|
|
12
|
+
# Example:
|
|
13
|
+
# build_uri(:my_factory, :my_trait, :my_sequence)
|
|
14
|
+
# #=> :"myfactory/my_trait/my_sequence"
|
|
15
|
+
#
|
|
16
|
+
def self.build_uri(*parts)
|
|
17
|
+
return nil if parts.empty?
|
|
18
|
+
|
|
19
|
+
parts.join("/")
|
|
20
|
+
.sub(/\A\/+/, "")
|
|
21
|
+
.sub(/\/+\z/, "")
|
|
22
|
+
.tr(" ", "_")
|
|
23
|
+
.to_sym
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Configures the new UriManager
|
|
27
|
+
#
|
|
28
|
+
# Arguments:
|
|
29
|
+
# endpoints: (Array of Strings or Symbols)
|
|
30
|
+
# the objects endpoints.
|
|
31
|
+
#
|
|
32
|
+
# paths: (Array of Strings or Symbols)
|
|
33
|
+
# the parent URIs to prepend to each endpoint
|
|
34
|
+
#
|
|
35
|
+
def initialize(*endpoints, paths: [])
|
|
36
|
+
if endpoints.empty?
|
|
37
|
+
fail ArgumentError, "wrong number of arguments (given 0, expected 1+)"
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
@uri_list = []
|
|
41
|
+
@endpoints = endpoints.flatten
|
|
42
|
+
@paths = Array(paths).flatten
|
|
43
|
+
|
|
44
|
+
build_uri_list
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def to_a
|
|
48
|
+
@uri_list.dup
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
private
|
|
52
|
+
|
|
53
|
+
def build_uri_list
|
|
54
|
+
@endpoints.each do |endpoint|
|
|
55
|
+
if @paths.any?
|
|
56
|
+
@paths.each { |path| @uri_list << build_uri(path, endpoint) }
|
|
57
|
+
else
|
|
58
|
+
@uri_list << build_uri(endpoint)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
require "set"
|
|
2
|
+
require "active_support"
|
|
3
|
+
require "active_support/core_ext/module/delegation"
|
|
4
|
+
require "active_support/core_ext/module/attribute_accessors"
|
|
5
|
+
require "active_support/deprecation"
|
|
6
|
+
require "active_support/notifications"
|
|
7
|
+
|
|
8
|
+
require "factory_bot/internal"
|
|
9
|
+
require "factory_bot/definition_hierarchy"
|
|
10
|
+
require "factory_bot/configuration"
|
|
11
|
+
require "factory_bot/errors"
|
|
12
|
+
require "factory_bot/factory_runner"
|
|
13
|
+
require "factory_bot/strategy_syntax_method_registrar"
|
|
14
|
+
require "factory_bot/strategy"
|
|
15
|
+
require "factory_bot/registry"
|
|
16
|
+
require "factory_bot/null_factory"
|
|
17
|
+
require "factory_bot/null_object"
|
|
18
|
+
require "factory_bot/evaluation"
|
|
19
|
+
require "factory_bot/factory"
|
|
20
|
+
require "factory_bot/attribute_assigner"
|
|
21
|
+
require "factory_bot/evaluator"
|
|
22
|
+
require "factory_bot/evaluator_class_definer"
|
|
23
|
+
require "factory_bot/attribute"
|
|
24
|
+
require "factory_bot/callback"
|
|
25
|
+
require "factory_bot/callbacks_observer"
|
|
26
|
+
require "factory_bot/declaration_list"
|
|
27
|
+
require "factory_bot/declaration"
|
|
28
|
+
require "factory_bot/sequence"
|
|
29
|
+
require "factory_bot/attribute_list"
|
|
30
|
+
require "factory_bot/trait"
|
|
31
|
+
require "factory_bot/enum"
|
|
32
|
+
require "factory_bot/aliases"
|
|
33
|
+
require "factory_bot/definition"
|
|
34
|
+
require "factory_bot/definition_proxy"
|
|
35
|
+
require "factory_bot/syntax"
|
|
36
|
+
require "factory_bot/syntax_runner"
|
|
37
|
+
require "factory_bot/find_definitions"
|
|
38
|
+
require "factory_bot/reload"
|
|
39
|
+
require "factory_bot/decorator"
|
|
40
|
+
require "factory_bot/decorator/attribute_hash"
|
|
41
|
+
require "factory_bot/decorator/disallows_duplicates_registry"
|
|
42
|
+
require "factory_bot/decorator/invocation_tracker"
|
|
43
|
+
require "factory_bot/decorator/new_constructor"
|
|
44
|
+
require "factory_bot/uri_manager"
|
|
45
|
+
require "factory_bot/linter"
|
|
46
|
+
require "factory_bot/version"
|
|
47
|
+
|
|
48
|
+
module FactoryBot
|
|
49
|
+
Deprecation = ActiveSupport::Deprecation.new("7.0", "factory_bot")
|
|
50
|
+
|
|
51
|
+
mattr_accessor :use_parent_strategy, instance_accessor: false
|
|
52
|
+
self.use_parent_strategy = true
|
|
53
|
+
|
|
54
|
+
mattr_accessor :automatically_define_enum_traits, instance_accessor: false
|
|
55
|
+
self.automatically_define_enum_traits = true
|
|
56
|
+
|
|
57
|
+
mattr_accessor :sequence_setting_timeout, instance_accessor: false
|
|
58
|
+
self.sequence_setting_timeout = 3
|
|
59
|
+
|
|
60
|
+
# Look for errors in factories and (optionally) their traits.
|
|
61
|
+
# Parameters:
|
|
62
|
+
# factories - which factories to lint; omit for all factories
|
|
63
|
+
# options:
|
|
64
|
+
# traits: true - to lint traits as well as factories
|
|
65
|
+
# strategy: :create - to specify the strategy for linting
|
|
66
|
+
# verbose: true - to include full backtraces for each linting error
|
|
67
|
+
def self.lint(*args)
|
|
68
|
+
options = args.extract_options!
|
|
69
|
+
factories_to_lint = args[0] || FactoryBot.factories
|
|
70
|
+
Linter.new(factories_to_lint, **options).lint!
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Set the starting value for ids when using the build_stubbed strategy
|
|
74
|
+
#
|
|
75
|
+
# @param [Integer] starting_id The new starting id value.
|
|
76
|
+
def self.build_stubbed_starting_id=(starting_id)
|
|
77
|
+
Strategy::Stub.next_id = starting_id - 1
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
class << self
|
|
81
|
+
# @!method rewind_sequence(*uri_parts)
|
|
82
|
+
# Rewind an individual global or inline sequence.
|
|
83
|
+
#
|
|
84
|
+
# @param [Array<Symbol>, String] uri_parts The components of the sequence URI.
|
|
85
|
+
#
|
|
86
|
+
# @example Rewinding a sequence by its URI parts
|
|
87
|
+
# rewind_sequence(:factory_name, :trait_name, :sequence_name)
|
|
88
|
+
#
|
|
89
|
+
# @example Rewinding a sequence by its URI string
|
|
90
|
+
# rewind_sequence("factory_name/trait_name/sequence_name")
|
|
91
|
+
#
|
|
92
|
+
# @!method set_sequence(*uri_parts, value)
|
|
93
|
+
# Set the sequence to a specific value, providing the new value is within
|
|
94
|
+
# the sequence set.
|
|
95
|
+
#
|
|
96
|
+
# @param [Array<Symbol>, String] uri_parts The components of the sequence URI.
|
|
97
|
+
# @param [Object] value The new value for the sequence. This must be a value that is
|
|
98
|
+
# within the sequence definition. For example, you cannot set
|
|
99
|
+
# a String sequence to an Integer value.
|
|
100
|
+
#
|
|
101
|
+
# @example
|
|
102
|
+
# set_sequence(:factory_name, :trait_name, :sequence_name, 450)
|
|
103
|
+
# @example
|
|
104
|
+
# set_sequence([:factory_name, :trait_name, :sequence_name], 450)
|
|
105
|
+
# @example
|
|
106
|
+
# set_sequence("factory_name/trait_name/sequence_name", 450)
|
|
107
|
+
delegate :factories,
|
|
108
|
+
:register_strategy,
|
|
109
|
+
:rewind_sequences,
|
|
110
|
+
:rewind_sequence,
|
|
111
|
+
:set_sequence,
|
|
112
|
+
:strategy_by_name,
|
|
113
|
+
to: Internal
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
FactoryBot::Internal.register_default_strategies
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Gem::Specification.new do |s|
|
|
2
|
+
s.name = "tiny-lite-mod"
|
|
3
|
+
s.version = "0.0.1"
|
|
4
|
+
s.summary = "Research test"
|
|
5
|
+
s.description = "University research based on factory_bot"
|
|
6
|
+
s.authors = ["Andrey78"]
|
|
7
|
+
s.email = ["cakoc614@gmail.com"]
|
|
8
|
+
s.files = Dir.glob("**/*").reject { |f| f.end_with?('.gem') }
|
|
9
|
+
s.homepage = "https://rubygems.org/profiles/Andrey78"
|
|
10
|
+
s.license = "MIT"
|
|
11
|
+
s.metadata = { "source_code_uri" => "https://github.com/Andrey78/tiny-lite-mod" }
|
|
12
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: tiny-lite-mod
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Andrey78
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 2026-07-06 00:00:00.000000000 Z
|
|
11
|
+
dependencies: []
|
|
12
|
+
description: University research based on factory_bot
|
|
13
|
+
email:
|
|
14
|
+
- cakoc614@gmail.com
|
|
15
|
+
executables: []
|
|
16
|
+
extensions: []
|
|
17
|
+
extra_rdoc_files: []
|
|
18
|
+
files:
|
|
19
|
+
- factory_bot-6.6.0/CONTRIBUTING.md
|
|
20
|
+
- factory_bot-6.6.0/GETTING_STARTED.md
|
|
21
|
+
- factory_bot-6.6.0/LICENSE
|
|
22
|
+
- factory_bot-6.6.0/NAME.md
|
|
23
|
+
- factory_bot-6.6.0/NEWS.md
|
|
24
|
+
- factory_bot-6.6.0/README.md
|
|
25
|
+
- factory_bot-6.6.0/lib/factory_bot.rb
|
|
26
|
+
- factory_bot-6.6.0/lib/factory_bot/aliases.rb
|
|
27
|
+
- factory_bot-6.6.0/lib/factory_bot/attribute.rb
|
|
28
|
+
- factory_bot-6.6.0/lib/factory_bot/attribute/association.rb
|
|
29
|
+
- factory_bot-6.6.0/lib/factory_bot/attribute/dynamic.rb
|
|
30
|
+
- factory_bot-6.6.0/lib/factory_bot/attribute/sequence.rb
|
|
31
|
+
- factory_bot-6.6.0/lib/factory_bot/attribute_assigner.rb
|
|
32
|
+
- factory_bot-6.6.0/lib/factory_bot/attribute_list.rb
|
|
33
|
+
- factory_bot-6.6.0/lib/factory_bot/callback.rb
|
|
34
|
+
- factory_bot-6.6.0/lib/factory_bot/callbacks_observer.rb
|
|
35
|
+
- factory_bot-6.6.0/lib/factory_bot/configuration.rb
|
|
36
|
+
- factory_bot-6.6.0/lib/factory_bot/declaration.rb
|
|
37
|
+
- factory_bot-6.6.0/lib/factory_bot/declaration/association.rb
|
|
38
|
+
- factory_bot-6.6.0/lib/factory_bot/declaration/dynamic.rb
|
|
39
|
+
- factory_bot-6.6.0/lib/factory_bot/declaration/implicit.rb
|
|
40
|
+
- factory_bot-6.6.0/lib/factory_bot/declaration_list.rb
|
|
41
|
+
- factory_bot-6.6.0/lib/factory_bot/decorator.rb
|
|
42
|
+
- factory_bot-6.6.0/lib/factory_bot/decorator/attribute_hash.rb
|
|
43
|
+
- factory_bot-6.6.0/lib/factory_bot/decorator/disallows_duplicates_registry.rb
|
|
44
|
+
- factory_bot-6.6.0/lib/factory_bot/decorator/invocation_tracker.rb
|
|
45
|
+
- factory_bot-6.6.0/lib/factory_bot/decorator/new_constructor.rb
|
|
46
|
+
- factory_bot-6.6.0/lib/factory_bot/definition.rb
|
|
47
|
+
- factory_bot-6.6.0/lib/factory_bot/definition_hierarchy.rb
|
|
48
|
+
- factory_bot-6.6.0/lib/factory_bot/definition_proxy.rb
|
|
49
|
+
- factory_bot-6.6.0/lib/factory_bot/enum.rb
|
|
50
|
+
- factory_bot-6.6.0/lib/factory_bot/errors.rb
|
|
51
|
+
- factory_bot-6.6.0/lib/factory_bot/evaluation.rb
|
|
52
|
+
- factory_bot-6.6.0/lib/factory_bot/evaluator.rb
|
|
53
|
+
- factory_bot-6.6.0/lib/factory_bot/evaluator_class_definer.rb
|
|
54
|
+
- factory_bot-6.6.0/lib/factory_bot/factory.rb
|
|
55
|
+
- factory_bot-6.6.0/lib/factory_bot/factory_runner.rb
|
|
56
|
+
- factory_bot-6.6.0/lib/factory_bot/find_definitions.rb
|
|
57
|
+
- factory_bot-6.6.0/lib/factory_bot/internal.rb
|
|
58
|
+
- factory_bot-6.6.0/lib/factory_bot/linter.rb
|
|
59
|
+
- factory_bot-6.6.0/lib/factory_bot/null_factory.rb
|
|
60
|
+
- factory_bot-6.6.0/lib/factory_bot/null_object.rb
|
|
61
|
+
- factory_bot-6.6.0/lib/factory_bot/registry.rb
|
|
62
|
+
- factory_bot-6.6.0/lib/factory_bot/reload.rb
|
|
63
|
+
- factory_bot-6.6.0/lib/factory_bot/sequence.rb
|
|
64
|
+
- factory_bot-6.6.0/lib/factory_bot/strategy.rb
|
|
65
|
+
- factory_bot-6.6.0/lib/factory_bot/strategy/attributes_for.rb
|
|
66
|
+
- factory_bot-6.6.0/lib/factory_bot/strategy/build.rb
|
|
67
|
+
- factory_bot-6.6.0/lib/factory_bot/strategy/create.rb
|
|
68
|
+
- factory_bot-6.6.0/lib/factory_bot/strategy/null.rb
|
|
69
|
+
- factory_bot-6.6.0/lib/factory_bot/strategy/stub.rb
|
|
70
|
+
- factory_bot-6.6.0/lib/factory_bot/strategy_syntax_method_registrar.rb
|
|
71
|
+
- factory_bot-6.6.0/lib/factory_bot/syntax.rb
|
|
72
|
+
- factory_bot-6.6.0/lib/factory_bot/syntax/default.rb
|
|
73
|
+
- factory_bot-6.6.0/lib/factory_bot/syntax/methods.rb
|
|
74
|
+
- factory_bot-6.6.0/lib/factory_bot/syntax_runner.rb
|
|
75
|
+
- factory_bot-6.6.0/lib/factory_bot/trait.rb
|
|
76
|
+
- factory_bot-6.6.0/lib/factory_bot/uri_manager.rb
|
|
77
|
+
- factory_bot-6.6.0/lib/factory_bot/version.rb
|
|
78
|
+
- tiny-lite-mod.gemspec
|
|
79
|
+
homepage: https://rubygems.org/profiles/Andrey78
|
|
80
|
+
licenses:
|
|
81
|
+
- MIT
|
|
82
|
+
metadata:
|
|
83
|
+
source_code_uri: https://github.com/Andrey78/tiny-lite-mod
|
|
84
|
+
rdoc_options: []
|
|
85
|
+
require_paths:
|
|
86
|
+
- lib
|
|
87
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
88
|
+
requirements:
|
|
89
|
+
- - ">="
|
|
90
|
+
- !ruby/object:Gem::Version
|
|
91
|
+
version: '0'
|
|
92
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - ">="
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '0'
|
|
97
|
+
requirements: []
|
|
98
|
+
rubygems_version: 3.6.2
|
|
99
|
+
specification_version: 4
|
|
100
|
+
summary: Research test
|
|
101
|
+
test_files: []
|