factory_bot 4.11.1 → 5.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/GETTING_STARTED.md +105 -29
  3. data/NEWS +17 -0
  4. data/README.md +3 -14
  5. data/lib/factory_bot.rb +56 -56
  6. data/lib/factory_bot/aliases.rb +1 -1
  7. data/lib/factory_bot/attribute.rb +4 -39
  8. data/lib/factory_bot/attribute_assigner.rb +20 -5
  9. data/lib/factory_bot/attribute_list.rb +2 -1
  10. data/lib/factory_bot/callback.rb +1 -0
  11. data/lib/factory_bot/configuration.rb +6 -18
  12. data/lib/factory_bot/declaration.rb +4 -4
  13. data/lib/factory_bot/declaration/association.rb +3 -1
  14. data/lib/factory_bot/declaration/dynamic.rb +3 -1
  15. data/lib/factory_bot/declaration/implicit.rb +3 -1
  16. data/lib/factory_bot/declaration_list.rb +1 -1
  17. data/lib/factory_bot/decorator.rb +5 -1
  18. data/lib/factory_bot/decorator/attribute_hash.rb +1 -1
  19. data/lib/factory_bot/decorator/invocation_tracker.rb +1 -1
  20. data/lib/factory_bot/definition.rb +4 -3
  21. data/lib/factory_bot/definition_proxy.rb +53 -62
  22. data/lib/factory_bot/errors.rb +4 -4
  23. data/lib/factory_bot/evaluation.rb +1 -1
  24. data/lib/factory_bot/evaluator.rb +4 -4
  25. data/lib/factory_bot/factory.rb +7 -7
  26. data/lib/factory_bot/factory_runner.rb +3 -3
  27. data/lib/factory_bot/find_definitions.rb +1 -1
  28. data/lib/factory_bot/linter.rb +35 -18
  29. data/lib/factory_bot/null_factory.rb +3 -0
  30. data/lib/factory_bot/null_object.rb +2 -2
  31. data/lib/factory_bot/registry.rb +15 -6
  32. data/lib/factory_bot/sequence.rb +0 -1
  33. data/lib/factory_bot/strategy/null.rb +2 -4
  34. data/lib/factory_bot/strategy/stub.rb +23 -29
  35. data/lib/factory_bot/strategy_syntax_method_registrar.rb +2 -2
  36. data/lib/factory_bot/syntax.rb +2 -2
  37. data/lib/factory_bot/syntax/default.rb +1 -1
  38. data/lib/factory_bot/trait.rb +2 -1
  39. data/lib/factory_bot/version.rb +1 -1
  40. metadata +68 -29
  41. data/lib/factory_bot/attribute/static.rb +0 -16
  42. data/lib/factory_bot/declaration/static.rb +0 -26
  43. data/lib/factory_bot/decorator/class_key_hash.rb +0 -28
@@ -1,3 +1,3 @@
1
1
  module FactoryBot
2
- VERSION = "4.11.1".freeze
2
+ VERSION = "5.0.0.rc1".freeze
3
3
  end
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: 4.11.1
4
+ version: 5.0.0.rc1
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: 2018-09-07 00:00:00.000000000 Z
12
+ date: 2019-01-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -17,42 +17,42 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: 3.0.0
20
+ version: 4.2.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: 3.0.0
27
+ version: 4.2.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: activerecord
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - ">="
33
33
  - !ruby/object:Gem::Version
34
- version: 3.0.0
34
+ version: '0'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - ">="
40
40
  - !ruby/object:Gem::Version
41
- version: 3.0.0
41
+ version: '0'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: appraisal
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - "~>"
46
+ - - ">="
47
47
  - !ruby/object:Gem::Version
48
- version: 2.1.0
48
+ version: '0'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - "~>"
53
+ - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: 2.1.0
55
+ version: '0'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: aruba
58
58
  requirement: !ruby/object:Gem::Requirement
@@ -71,44 +71,72 @@ dependencies:
71
71
  name: cucumber
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - "~>"
74
+ - - ">="
75
75
  - !ruby/object:Gem::Version
76
- version: 1.3.15
76
+ version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - "~>"
81
+ - - ">="
82
82
  - !ruby/object:Gem::Version
83
- version: 1.3.15
83
+ version: '0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: rake
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
84
98
  - !ruby/object:Gem::Dependency
85
99
  name: rspec
86
100
  requirement: !ruby/object:Gem::Requirement
87
101
  requirements:
88
- - - "~>"
102
+ - - ">="
89
103
  - !ruby/object:Gem::Version
90
- version: '3.0'
104
+ version: '0'
91
105
  type: :development
92
106
  prerelease: false
93
107
  version_requirements: !ruby/object:Gem::Requirement
94
108
  requirements:
95
- - - "~>"
109
+ - - ">="
96
110
  - !ruby/object:Gem::Version
97
- version: '3.0'
111
+ version: '0'
98
112
  - !ruby/object:Gem::Dependency
99
113
  name: rspec-its
100
114
  requirement: !ruby/object:Gem::Requirement
101
115
  requirements:
102
- - - "~>"
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
103
124
  - !ruby/object:Gem::Version
104
- version: '1.0'
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: rubocop
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - '='
131
+ - !ruby/object:Gem::Version
132
+ version: '0.54'
105
133
  type: :development
106
134
  prerelease: false
107
135
  version_requirements: !ruby/object:Gem::Requirement
108
136
  requirements:
109
- - - "~>"
137
+ - - '='
110
138
  - !ruby/object:Gem::Version
111
- version: '1.0'
139
+ version: '0.54'
112
140
  - !ruby/object:Gem::Dependency
113
141
  name: simplecov
114
142
  requirement: !ruby/object:Gem::Requirement
@@ -123,6 +151,20 @@ dependencies:
123
151
  - - ">="
124
152
  - !ruby/object:Gem::Version
125
153
  version: '0'
154
+ - !ruby/object:Gem::Dependency
155
+ name: sqlite3
156
+ requirement: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - ">="
159
+ - !ruby/object:Gem::Version
160
+ version: '0'
161
+ type: :development
162
+ prerelease: false
163
+ version_requirements: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - ">="
166
+ - !ruby/object:Gem::Version
167
+ version: '0'
126
168
  - !ruby/object:Gem::Dependency
127
169
  name: timecop
128
170
  requirement: !ruby/object:Gem::Requirement
@@ -173,7 +215,6 @@ files:
173
215
  - lib/factory_bot/attribute/association.rb
174
216
  - lib/factory_bot/attribute/dynamic.rb
175
217
  - lib/factory_bot/attribute/sequence.rb
176
- - lib/factory_bot/attribute/static.rb
177
218
  - lib/factory_bot/attribute_assigner.rb
178
219
  - lib/factory_bot/attribute_list.rb
179
220
  - lib/factory_bot/callback.rb
@@ -183,11 +224,9 @@ files:
183
224
  - lib/factory_bot/declaration/association.rb
184
225
  - lib/factory_bot/declaration/dynamic.rb
185
226
  - lib/factory_bot/declaration/implicit.rb
186
- - lib/factory_bot/declaration/static.rb
187
227
  - lib/factory_bot/declaration_list.rb
188
228
  - lib/factory_bot/decorator.rb
189
229
  - lib/factory_bot/decorator/attribute_hash.rb
190
- - lib/factory_bot/decorator/class_key_hash.rb
191
230
  - lib/factory_bot/decorator/disallows_duplicates_registry.rb
192
231
  - lib/factory_bot/decorator/invocation_tracker.rb
193
232
  - lib/factory_bot/decorator/new_constructor.rb
@@ -232,15 +271,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
232
271
  requirements:
233
272
  - - ">="
234
273
  - !ruby/object:Gem::Version
235
- version: 1.9.2
274
+ version: 2.3.0
236
275
  required_rubygems_version: !ruby/object:Gem::Requirement
237
276
  requirements:
238
- - - ">="
277
+ - - ">"
239
278
  - !ruby/object:Gem::Version
240
- version: '0'
279
+ version: 1.3.1
241
280
  requirements: []
242
281
  rubyforge_project:
243
- rubygems_version: 2.7.7
282
+ rubygems_version: 2.7.6
244
283
  signing_key:
245
284
  specification_version: 4
246
285
  summary: factory_bot provides a framework and DSL for defining and using model instance
@@ -1,16 +0,0 @@
1
- module FactoryBot
2
- class Attribute
3
- # @api private
4
- class Static < Attribute
5
- def initialize(name, value, ignored)
6
- super(name, ignored)
7
- @value = value
8
- end
9
-
10
- def to_proc
11
- value = @value
12
- -> { value }
13
- end
14
- end
15
- end
16
- end
@@ -1,26 +0,0 @@
1
- module FactoryBot
2
- class Declaration
3
- # @api private
4
- class Static < Declaration
5
- def initialize(name, value, ignored = false)
6
- super(name, ignored)
7
- @value = value
8
- end
9
-
10
- def ==(other)
11
- name == other.name &&
12
- value == other.value &&
13
- ignored == other.ignored
14
- end
15
-
16
- protected
17
- attr_reader :value
18
-
19
- private
20
-
21
- def build
22
- [Attribute::Static.new(name, @value, @ignored)]
23
- end
24
- end
25
- end
26
- end
@@ -1,28 +0,0 @@
1
- module FactoryBot
2
- class Decorator
3
- class ClassKeyHash < Decorator
4
- def [](key)
5
- @component[symbolized_key key]
6
- end
7
-
8
- def []=(key, value)
9
- @component[symbolized_key key] = value
10
- end
11
-
12
- def key?(key)
13
- @component.key? symbolized_key(key)
14
- end
15
-
16
- private
17
-
18
- def symbolized_key(key)
19
- if key.respond_to?(:to_sym)
20
- key.to_sym
21
- elsif FactoryBot.allow_class_lookup
22
- ActiveSupport::Deprecation.warn "Looking up factories by class is deprecated and will be removed in 5.0. Use symbols instead and set FactoryBot.allow_class_lookup = false", caller
23
- key.to_s.underscore.to_sym
24
- end
25
- end
26
- end
27
- end
28
- end