factory_bot 4.11.0 → 5.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +6 -0
  3. data/GETTING_STARTED.md +121 -37
  4. data/LICENSE +1 -1
  5. data/NEWS.md +351 -0
  6. data/README.md +21 -25
  7. data/lib/factory_bot/aliases.rb +1 -1
  8. data/lib/factory_bot/attribute/dynamic.rb +1 -0
  9. data/lib/factory_bot/attribute.rb +4 -39
  10. data/lib/factory_bot/attribute_assigner.rb +21 -6
  11. data/lib/factory_bot/attribute_list.rb +2 -1
  12. data/lib/factory_bot/callback.rb +3 -2
  13. data/lib/factory_bot/configuration.rb +16 -20
  14. data/lib/factory_bot/declaration/association.rb +14 -1
  15. data/lib/factory_bot/declaration/dynamic.rb +3 -1
  16. data/lib/factory_bot/declaration/implicit.rb +7 -2
  17. data/lib/factory_bot/declaration.rb +4 -4
  18. data/lib/factory_bot/declaration_list.rb +1 -1
  19. data/lib/factory_bot/decorator/attribute_hash.rb +1 -1
  20. data/lib/factory_bot/decorator/invocation_tracker.rb +1 -1
  21. data/lib/factory_bot/decorator.rb +5 -1
  22. data/lib/factory_bot/definition.rb +10 -7
  23. data/lib/factory_bot/definition_hierarchy.rb +1 -11
  24. data/lib/factory_bot/definition_proxy.rb +59 -62
  25. data/lib/factory_bot/errors.rb +7 -4
  26. data/lib/factory_bot/evaluation.rb +1 -1
  27. data/lib/factory_bot/evaluator.rb +5 -5
  28. data/lib/factory_bot/factory.rb +8 -8
  29. data/lib/factory_bot/factory_runner.rb +3 -3
  30. data/lib/factory_bot/find_definitions.rb +1 -1
  31. data/lib/factory_bot/internal.rb +104 -0
  32. data/lib/factory_bot/linter.rb +36 -19
  33. data/lib/factory_bot/null_factory.rb +4 -1
  34. data/lib/factory_bot/null_object.rb +2 -2
  35. data/lib/factory_bot/registry.rb +15 -6
  36. data/lib/factory_bot/reload.rb +3 -3
  37. data/lib/factory_bot/sequence.rb +0 -1
  38. data/lib/factory_bot/strategy/null.rb +2 -4
  39. data/lib/factory_bot/strategy/stub.rb +32 -31
  40. data/lib/factory_bot/strategy_calculator.rb +1 -1
  41. data/lib/factory_bot/strategy_syntax_method_registrar.rb +13 -2
  42. data/lib/factory_bot/syntax/default.rb +12 -24
  43. data/lib/factory_bot/syntax/methods.rb +32 -9
  44. data/lib/factory_bot/syntax.rb +2 -2
  45. data/lib/factory_bot/trait.rb +6 -3
  46. data/lib/factory_bot/version.rb +1 -1
  47. data/lib/factory_bot.rb +103 -138
  48. metadata +73 -32
  49. data/NEWS +0 -303
  50. data/lib/factory_bot/attribute/static.rb +0 -16
  51. data/lib/factory_bot/declaration/static.rb +0 -26
  52. data/lib/factory_bot/decorator/class_key_hash.rb +0 -28
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.0
4
+ version: 5.2.0
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-08-16 00:00:00.000000000 Z
12
+ date: 2020-04-24 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,46 +71,74 @@ dependencies:
71
71
  name: cucumber
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - "~>"
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: rake
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
75
89
  - !ruby/object:Gem::Version
76
- version: 1.3.15
90
+ version: '0'
77
91
  type: :development
78
92
  prerelease: false
79
93
  version_requirements: !ruby/object:Gem::Requirement
80
94
  requirements:
81
- - - "~>"
95
+ - - ">="
82
96
  - !ruby/object:Gem::Version
83
- version: 1.3.15
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
+ - - ">="
103
117
  - !ruby/object:Gem::Version
104
- version: '1.0'
118
+ version: '0'
105
119
  type: :development
106
120
  prerelease: false
107
121
  version_requirements: !ruby/object:Gem::Requirement
108
122
  requirements:
109
- - - "~>"
123
+ - - ">="
110
124
  - !ruby/object:Gem::Version
111
- version: '1.0'
125
+ version: '0'
112
126
  - !ruby/object:Gem::Dependency
113
- name: simplecov
127
+ name: rubocop
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ type: :development
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ - !ruby/object:Gem::Dependency
141
+ name: rubocop-performance
114
142
  requirement: !ruby/object:Gem::Requirement
115
143
  requirements:
116
144
  - - ">="
@@ -124,7 +152,21 @@ dependencies:
124
152
  - !ruby/object:Gem::Version
125
153
  version: '0'
126
154
  - !ruby/object:Gem::Dependency
127
- name: timecop
155
+ name: rubocop-rails
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'
168
+ - !ruby/object:Gem::Dependency
169
+ name: simplecov
128
170
  requirement: !ruby/object:Gem::Requirement
129
171
  requirements:
130
172
  - - ">="
@@ -160,11 +202,12 @@ executables: []
160
202
  extensions: []
161
203
  extra_rdoc_files: []
162
204
  files:
205
+ - ".yardopts"
163
206
  - CONTRIBUTING.md
164
207
  - GETTING_STARTED.md
165
208
  - LICENSE
166
209
  - NAME.md
167
- - NEWS
210
+ - NEWS.md
168
211
  - README.md
169
212
  - lib/factory_bot.rb
170
213
  - lib/factory_bot/aliases.rb
@@ -172,7 +215,6 @@ files:
172
215
  - lib/factory_bot/attribute/association.rb
173
216
  - lib/factory_bot/attribute/dynamic.rb
174
217
  - lib/factory_bot/attribute/sequence.rb
175
- - lib/factory_bot/attribute/static.rb
176
218
  - lib/factory_bot/attribute_assigner.rb
177
219
  - lib/factory_bot/attribute_list.rb
178
220
  - lib/factory_bot/callback.rb
@@ -182,11 +224,9 @@ files:
182
224
  - lib/factory_bot/declaration/association.rb
183
225
  - lib/factory_bot/declaration/dynamic.rb
184
226
  - lib/factory_bot/declaration/implicit.rb
185
- - lib/factory_bot/declaration/static.rb
186
227
  - lib/factory_bot/declaration_list.rb
187
228
  - lib/factory_bot/decorator.rb
188
229
  - lib/factory_bot/decorator/attribute_hash.rb
189
- - lib/factory_bot/decorator/class_key_hash.rb
190
230
  - lib/factory_bot/decorator/disallows_duplicates_registry.rb
191
231
  - lib/factory_bot/decorator/invocation_tracker.rb
192
232
  - lib/factory_bot/decorator/new_constructor.rb
@@ -200,6 +240,7 @@ files:
200
240
  - lib/factory_bot/factory.rb
201
241
  - lib/factory_bot/factory_runner.rb
202
242
  - lib/factory_bot/find_definitions.rb
243
+ - lib/factory_bot/internal.rb
203
244
  - lib/factory_bot/linter.rb
204
245
  - lib/factory_bot/null_factory.rb
205
246
  - lib/factory_bot/null_object.rb
@@ -222,7 +263,8 @@ files:
222
263
  homepage: https://github.com/thoughtbot/factory_bot
223
264
  licenses:
224
265
  - MIT
225
- metadata: {}
266
+ metadata:
267
+ changelog_uri: https://github.com/thoughtbot/factory_bot/blob/master/NEWS.md
226
268
  post_install_message:
227
269
  rdoc_options: []
228
270
  require_paths:
@@ -231,15 +273,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
231
273
  requirements:
232
274
  - - ">="
233
275
  - !ruby/object:Gem::Version
234
- version: 1.9.2
276
+ version: 2.3.0
235
277
  required_rubygems_version: !ruby/object:Gem::Requirement
236
278
  requirements:
237
279
  - - ">="
238
280
  - !ruby/object:Gem::Version
239
281
  version: '0'
240
282
  requirements: []
241
- rubyforge_project:
242
- rubygems_version: 2.7.7
283
+ rubygems_version: 3.0.3
243
284
  signing_key:
244
285
  specification_version: 4
245
286
  summary: factory_bot provides a framework and DSL for defining and using model instance
data/NEWS DELETED
@@ -1,303 +0,0 @@
1
- 4.11.0 (August, 15, 2018)
2
- Bugfix: Do not raise error for valid build_stubbed methods: decrement, increment, and toggle
3
- Bugfix: Do not add timestamps with build_stubbed for objects that shouldn't have timestamps
4
- Deprecate static attributes
5
-
6
- 4.10.0 (May 25, 2018)
7
- Allow sequences to be rewound
8
-
9
- 4.9.0 (skipped - FactoryGirl only release)
10
-
11
- 4.8.2 (October 20, 2017)
12
- Rename factory_girl to factory_bot
13
-
14
- 4.8.1 (September 28, 2017)
15
- Explicitly define `#destroyed?` within the `Stub` strategy to return `nil` instead of raising
16
- Update various dependencies
17
- Update internal test suite to use RSpec's mocking/stubbing instead of mocha
18
-
19
- 4.8.0 (December 16, 2016)
20
- Improve documentation
21
- Add `FactoryGirl.generate_list` to be consistent with `build_list`/`create_list` and friends
22
- Add `FactoryGirl.use_parent_strategy` configuration to allow associations to leverage parent build strategy
23
-
24
- 4.7.0 (April 1, 2016)
25
- Improve documentation
26
- Improve instrumentation payload to include traits, overrides, and the factory itself
27
- Allow linting of traits
28
- Deprecate factory lookup by class name in preparation for 5.0
29
- Improve internal performance by using flat_map instead of map and compact
30
- Improve handling of dirty attributes after building a stubbed object
31
- Reduce warnings from redefining methods
32
-
33
- 4.6.0 (skipped)
34
-
35
- 4.5.0 (October 17, 2014)
36
- Improve FactoryGirl.lint by including exception and message in output
37
- Allow selective linting
38
- Use more explicit #public_send when doing attribute assignment
39
- Improve documentation around FactoryGirl.lint and initialize_with
40
- Deprecate #ignore in favor of #transient
41
-
42
- 4.4.0 (February 10, 2014)
43
- Add FactoryGirl.lint
44
- Fix memory leak in duplicate traits
45
- Update documentation
46
-
47
- 4.3.0 (November 3, 2013)
48
- Start testing against Rails 4.0 and Ruby 2.0.0
49
- Stop testing against Rails 3.0 and Ruby 1.9.2
50
- Add *_pair methods to only build two objects
51
- Raise if a method is defined with a FactoryGirl block (factory or trait)
52
- Allow use of Symbol#to_proc in callbacks
53
- Add global callbacks
54
- Improve GETTING_STARTED and README
55
-
56
- 4.2.0 (January 18, 2013)
57
- Improve documentation
58
- Allow *_list syntax methods to accept a block
59
- Update gem dependencies
60
- Allow setting id for objects created with `build_stubbed`
61
- Fix Stub strategy to mimic ActiveRecord regarding `created_at`
62
- Evaluate sequences within the context of an Evaluator
63
- Fix Mocha deprecation warning
64
- Fix some warnings when running RUBYOPT=-w rake
65
- Convert test suite to RSpec's "expect" syntax
66
-
67
- 4.1.0 (September 11, 2012)
68
- Allow multiple callbacks to bind to the same block
69
- Fix documentation surrounding the stub strategy
70
-
71
- 4.0.0 (August 3, 2012)
72
- Remove deprecated cucumber_steps
73
- Remove deprecated alternate syntaxes
74
- Deprecate duplicate_attribute_assignment_from_initialize_with, which is now unused
75
- as attributes assigned within initialize_with are not subsequently assigned
76
-
77
- 3.6.1 (August 2, 2012)
78
- Update README to include info about running with JRuby
79
- Update dependencies on RSpec and tiny versions of Rails in Appraisal
80
- Improve flexibility of using traits with associations and add documentation
81
- Stub update_column to raise to mirror ActiveRecord's change from update_attribute
82
-
83
- 3.6.0 (July 27, 2012)
84
- Code/spec cleanup
85
- Allow factories with traits to be used in associations
86
- Refactor Factory to use DefinitionHierarchy to handle managing callbacks,
87
- custom constructor, and custom to_create
88
- Add memoization to speed up factories providing attribute overrides
89
- Add initial support of JRuby when running in 1.9 mode
90
- Improve docs on what happens when including FactoryGirl::Syntax::Methods
91
-
92
- 3.5.0 (June 22, 2012)
93
- Allow created_at to be set when using build_stubbed
94
- Deprecate FactoryGirl step definitions
95
-
96
- 3.4.2 (June 19, 2012)
97
- Fix bug in traits with callbacks called implicitly in factories whose
98
- callbacks trigger multiple times
99
-
100
- 3.4.1 (June 18, 2012)
101
- Fix traits so they can be nested and referred to from other traits
102
-
103
- 3.4.0 (June 11, 2012)
104
- Sequences support Enumerators
105
- Optionally disable duplicate assignment of attributes in initialize_with
106
- Make hash of public attributes available in initialize_with
107
- Support referring to a factory based on class name
108
-
109
- 3.3.0 (May 13, 2012)
110
- Allow to_create, skip_create, and initialize_with to be defined globally
111
- Allow to_create, skip_create, and initialize_with to be defined within traits
112
- Fix deprecation messages for alternate syntaxes (make, generate, etc.)
113
- Improve library documentation
114
- Deprecate after_build, after_create, before_create, after_stub in favor of new callbacks
115
- Introduce new callback syntax: after(:build) {}, after(:custom) {}, or callback(:different) {}
116
- This allows for declaring any callback, usable with custom strategies
117
- Add attributes_for_list and build_stubbed_list with the StrategySyntaxMethodRegistrar
118
- Allow use of syntax methods (build, create, generate, etc) implicitly in callbacks
119
- Internal refactoring of a handful of components
120
-
121
- 3.2.0 (April 24, 2012)
122
- Use AS::Notifications for pub/sub to track running factories
123
- Call new within initialize_with implicitly on the build class
124
- Skip to_create with skip_create
125
- Allow registration of custom strategies
126
- Deprecate alternate syntaxes
127
- Implicitly call factory_bot's syntax methods from dynamic attributes
128
-
129
- 3.1.0 (April 6, 2012)
130
- Sequences support aliases, which reference the same block
131
- Update documentation
132
- Add before_create callback
133
- Support use of #attribute_names method to determine available attributes for steps
134
- Use ActiveSupport::Deprecation for all deprecations
135
-
136
- 3.0.0 (March 23, 2012)
137
- Deprecate the vintage syntax
138
- Remove Rails 2.x support
139
- Remove Ruby 1.8 support
140
- Remove deprecated features, including default_strategy, factory_name,
141
- :method for defining default strategy, ignore on individual attributes, and
142
- interacting with Factory the way you would FactoryGirl
143
-
144
- 2.6.4 (March 16, 2012)
145
- Do not ignore names of transient attributes
146
- Ensure attributes set on instance are calculated uniquely
147
-
148
- 2.6.3 (March 9, 2012)
149
- Fix issue with traits not being present the first time a factory is accessed
150
- Update available Cucumber step definitions to not require a trailing colon
151
- when building a table of attributes to instantiate records with
152
-
153
- 2.6.2 (March 9, 2012)
154
- Allow factories to use all their ancestors' traits
155
- Ignore bin dir generated by bundler
156
- Namespace ::Factory as top-level to fix vintage syntax issue with
157
- Ruby 1.9.2-p3p18
158
-
159
- 2.6.1 (March 2, 2012)
160
- Use FactoryGirl.reload in specs
161
- Clean up running named factories with a particular strategy with
162
- FactoryGirl::FactoryRunner
163
-
164
- 2.6.0 (February 17, 2012)
165
- Improve documentation of has_many associations in the GETTING_STARTED
166
- document
167
- Deprecate :method in favor of :strategy when overriding an association's
168
- build strategy
169
-
170
- 2.5.2 (February 10, 2012)
171
- Fix step definitions to use associations defined in parent factories
172
- Add inline trait support to (build|create)_list
173
- Update ActiveSupport dependency to >= 2.3.9, which introduced
174
- class_attribute
175
-
176
- 2.5.1 (February 3, 2012)
177
- Fix attribute evaluation when the attribute isn't defined in the factory but
178
- is a private method on Object
179
- Update rubygems on Travis before running tests
180
- Fix spec name
181
- Update GETTING_STARTED with correct usage of build_stubbed
182
- Update README with more info on initialize_with
183
- Honor :parent on factory over block nesting
184
-
185
- 2.5.0 (January 20, 2012)
186
- Revert 'Deprecate build_stubbed and attributes_for'
187
- Implement initialize_with to allow overriding object instantiation
188
- Ensure FG runs against Rails 3.2.0
189
-
190
- 2.4.2 (January 18, 2012)
191
- Fix inline traits' interaction with defaults on the factory
192
-
193
- 2.4.1 (January 17, 2012)
194
- Deprecate build_stubbed and attributes_for
195
- Fix inline traits
196
-
197
- 2.4.0 (January 13, 2012)
198
- Refactor internals of FactoryGirl to use anonymous class on which attributes
199
- get defined
200
- Explicitly require Ruby 1.8.7 or higher in gemspec
201
- Fix documentation
202
- Add Gemnasium status to documentation
203
- Supplying a Class to a factory that overrides to_s no longer results in
204
- getting the wrong Class constructed
205
- Be more agnostic about ORMs when using columns in FactoryGirl step
206
- definitions
207
- Test against Active Record 3.2.0.rc2
208
- Update GETTING_STARTED to use Ruby syntax highlighting
209
-
210
- 2.3.2 (November 26, 2011)
211
- Move logic of where instance.save! is set to Definition
212
- Fix method name from aliases_for? to alias_for?
213
- Refactor internal attribute handling to use an anonymous class instead of
214
- faking Ruby's variable resolution. This allows for more sane usage of
215
- attributes without having to manage sorting priority because attributes
216
- can turn themselves into procs, which are used with define_method on a
217
- class so attributes work correctly all the time.
218
-
219
- 2.3.1 (November 23, 2011)
220
- Remove internally-used associate method from all the FactoryGirl::Proxy subclasses
221
- Move around requiring of files
222
- Consolidate errors into factory_bot.rb
223
- Refactor AttributeList to deal with priority only when iterating over
224
- attributes
225
- Refactor internals of some of the Proxy subclasses
226
- Ensure callbacks on traits are executed in the correct order
227
-
228
- 2.3.0 (November 18, 2011)
229
- Registries are named, resulting in better messages when factories, traits,
230
- or sequences cannot be found
231
- Fix incorrect tests
232
- Internals refactoring introducing FactoryGirl::NullFactory,
233
- FactoryGirl::Definition, and FactoryGirl::DeclarationList
234
- Use ActiveSupport for Hash#except and its delegation capabilities
235
- Fix usage of callbacks when added via implicit traits
236
- Use Bundler tasks and clean up dependencies
237
- Fix failing spec for big letters in factory name passed as symbol
238
- Add ability for traits to be added dynamically when creating an instance via
239
- build, create, build_stubbed, or attributes_for
240
-
241
- 2.2.0 (October 14, 2011)
242
- Clean up RSpec suite to not use 'should'
243
- Use create_list in step definitions
244
- Syntax methods that deal with ORM interaction (attributes_for, build, build_stubbed,
245
- and create) now accept a block that yields the result. This results in a
246
- more convenient way to interact with the result than using Object.tap.
247
- Standardize deprecation warnings
248
- Update transient attribute syntax to use blocks instead of calling ignore on
249
- each attribute declaration
250
- Parents can be defined after children because factories are evaluated when
251
- they're used; this means breaking up factories across multiple files will
252
- behave as expected
253
- Large internal refactoring, including changing access modifiers for a
254
- handful of methods for a more clearly defined API
255
-
256
- 2.1.2 (September 23, 2011)
257
- Bugfix: Vintage syntax fixed after bug introduced in 2.1.1
258
- Introduce dependency on activesupport to remove code from Factory class
259
-
260
- 2.1.1 (September 23, 2011) (yanked)
261
- Bugfix: Parent object callbacks are run before child object callbacks
262
- Declarations: allow overriding/modification of individual traits in child factories
263
- Callbacks refactored to not be attributes
264
- Updating documentation for formatting and clarity (incl. new specificity for cucumber)
265
-
266
- 2.1.0 (September 02, 2011)
267
- Bugfix: created_at now defined for stubbed models
268
- Gemspec updated for use with Rails 3.1
269
- Factories can now be modified post-definition (useful for overriding defaults from gems/plugins)
270
- All factories can now be reloaded with Factory.reload
271
- Add :method => build to factory associations to prevent saving of associated objects
272
- Factories defined in {Rails.root}/factories are now loaded by default
273
- Various documentation updates
274
-
275
- 1.1.4 (November 28, 2008)
276
- Factory.build now uses Factory.create for associations of the built object
277
- Factory definitions are now detected in subdirectories, such as
278
- factories/person_factory.rb (thanks to Josh Nichols)
279
- Factory definitions are now loaded after the environment in a Rails project
280
- (fixes some issues with dependencies being loaded too early) (thanks to
281
- Josh Nichols)
282
- Factory names ending in 's' no longer cause problems (thanks to Alex Sharp
283
- and Josh Owens)
284
-
285
- 1.1.3 (September 12, 2008)
286
- Automatically pull in definitions from factories.rb, test/factories.rb, or
287
- spec/factories.rb
288
- 1.1.2 (July 30, 2008)
289
- Improved error handling for invalid and undefined factories/attributes
290
- Improved handling of strings vs symbols vs classes
291
- Added a prettier syntax for handling associations
292
- Updated documentation and fixed compatibility with Rails 2.1
293
-
294
- 1.1.1 (June 23, 2008)
295
- The attribute "name" no longer requires using #add_attribute
296
-
297
- 1.1.0 (June 03, 2008)
298
- Added support for dependent attributes
299
- Fixed the attributes_for build strategy to not build associations
300
- Added support for sequences
301
-
302
- 1.0.0 (May 31, 2008)
303
- First version
@@ -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