ffactory_girl 4.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +7 -0
  2. data/.autotest +9 -0
  3. data/.gitignore +9 -0
  4. data/.rspec +2 -0
  5. data/.simplecov +4 -0
  6. data/.travis.yml +38 -0
  7. data/.yardopts +5 -0
  8. data/Appraisals +19 -0
  9. data/CONTRIBUTING.md +60 -0
  10. data/GETTING_STARTED.md +1391 -0
  11. data/Gemfile +8 -0
  12. data/Gemfile.lock +116 -0
  13. data/LICENSE +19 -0
  14. data/NAME.md +11 -0
  15. data/NEWS +290 -0
  16. data/README.md +98 -0
  17. data/Rakefile +36 -0
  18. data/cucumber.yml +1 -0
  19. data/factory_girl.gemspec +36 -0
  20. data/gemfiles/3.2.gemfile +10 -0
  21. data/gemfiles/3.2.gemfile.lock +105 -0
  22. data/gemfiles/4.0.gemfile +10 -0
  23. data/gemfiles/4.0.gemfile.lock +105 -0
  24. data/gemfiles/4.1.gemfile +10 -0
  25. data/gemfiles/4.1.gemfile.lock +104 -0
  26. data/gemfiles/4.2.gemfile +10 -0
  27. data/gemfiles/4.2.gemfile.lock +104 -0
  28. data/gemfiles/5.0.gemfile +10 -0
  29. data/gemfiles/5.0.gemfile.lock +103 -0
  30. data/lib/factory_girl/aliases.rb +18 -0
  31. data/lib/factory_girl/attribute/association.rb +27 -0
  32. data/lib/factory_girl/attribute/dynamic.rb +24 -0
  33. data/lib/factory_girl/attribute/sequence.rb +16 -0
  34. data/lib/factory_girl/attribute/static.rb +16 -0
  35. data/lib/factory_girl/attribute.rb +62 -0
  36. data/lib/factory_girl/attribute_assigner.rb +97 -0
  37. data/lib/factory_girl/attribute_list.rb +67 -0
  38. data/lib/factory_girl/callback.rb +40 -0
  39. data/lib/factory_girl/callbacks_observer.rb +21 -0
  40. data/lib/factory_girl/configuration.rb +37 -0
  41. data/lib/factory_girl/declaration/association.rb +28 -0
  42. data/lib/factory_girl/declaration/dynamic.rb +26 -0
  43. data/lib/factory_girl/declaration/implicit.rb +33 -0
  44. data/lib/factory_girl/declaration/static.rb +26 -0
  45. data/lib/factory_girl/declaration.rb +23 -0
  46. data/lib/factory_girl/declaration_list.rb +49 -0
  47. data/lib/factory_girl/decorator/attribute_hash.rb +16 -0
  48. data/lib/factory_girl/decorator/class_key_hash.rb +28 -0
  49. data/lib/factory_girl/decorator/disallows_duplicates_registry.rb +13 -0
  50. data/lib/factory_girl/decorator/invocation_tracker.rb +19 -0
  51. data/lib/factory_girl/decorator/new_constructor.rb +12 -0
  52. data/lib/factory_girl/decorator.rb +21 -0
  53. data/lib/factory_girl/definition.rb +136 -0
  54. data/lib/factory_girl/definition_hierarchy.rb +48 -0
  55. data/lib/factory_girl/definition_proxy.rb +174 -0
  56. data/lib/factory_girl/errors.rb +25 -0
  57. data/lib/factory_girl/evaluation.rb +27 -0
  58. data/lib/factory_girl/evaluator.rb +82 -0
  59. data/lib/factory_girl/evaluator_class_definer.rb +20 -0
  60. data/lib/factory_girl/factory.rb +163 -0
  61. data/lib/factory_girl/factory_runner.rb +33 -0
  62. data/lib/factory_girl/find_definitions.rb +25 -0
  63. data/lib/factory_girl/linter.rb +97 -0
  64. data/lib/factory_girl/null_factory.rb +18 -0
  65. data/lib/factory_girl/null_object.rb +24 -0
  66. data/lib/factory_girl/registry.rb +38 -0
  67. data/lib/factory_girl/reload.rb +8 -0
  68. data/lib/factory_girl/sequence.rb +62 -0
  69. data/lib/factory_girl/strategy/attributes_for.rb +13 -0
  70. data/lib/factory_girl/strategy/build.rb +15 -0
  71. data/lib/factory_girl/strategy/create.rb +18 -0
  72. data/lib/factory_girl/strategy/null.rb +11 -0
  73. data/lib/factory_girl/strategy/stub.rb +111 -0
  74. data/lib/factory_girl/strategy_calculator.rb +26 -0
  75. data/lib/factory_girl/strategy_syntax_method_registrar.rb +54 -0
  76. data/lib/factory_girl/syntax/default.rb +76 -0
  77. data/lib/factory_girl/syntax/methods.rb +111 -0
  78. data/lib/factory_girl/syntax.rb +7 -0
  79. data/lib/factory_girl/syntax_runner.rb +6 -0
  80. data/lib/factory_girl/trait.rb +30 -0
  81. data/lib/factory_girl/version.rb +3 -0
  82. data/lib/factory_girl.rb +156 -0
  83. metadata +271 -0
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ gem 'activerecord-jdbcsqlite3-adapter', platforms: :jruby
6
+ gem 'jdbc-sqlite3', platforms: :jruby
7
+
8
+ gem 'sqlite3', '~> 1.3.10', platforms: :ruby
data/Gemfile.lock ADDED
@@ -0,0 +1,116 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ factory_girl (4.8.1)
5
+ activesupport (>= 3.0.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activemodel (5.0.0.1)
11
+ activesupport (= 5.0.0.1)
12
+ activerecord (5.0.0.1)
13
+ activemodel (= 5.0.0.1)
14
+ activesupport (= 5.0.0.1)
15
+ arel (~> 7.0)
16
+ activerecord-jdbc-adapter (1.3.21)
17
+ activerecord (>= 2.2)
18
+ activerecord-jdbcsqlite3-adapter (1.3.21)
19
+ activerecord-jdbc-adapter (~> 1.3.21)
20
+ jdbc-sqlite3 (>= 3.7.2, < 3.9)
21
+ activesupport (5.0.0.1)
22
+ concurrent-ruby (~> 1.0, >= 1.0.2)
23
+ i18n (~> 0.7)
24
+ minitest (~> 5.1)
25
+ tzinfo (~> 1.1)
26
+ appraisal (2.1.0)
27
+ bundler
28
+ rake
29
+ thor (>= 0.14.0)
30
+ arel (7.1.4)
31
+ aruba (0.13.0)
32
+ childprocess (~> 0.5.6)
33
+ contracts (~> 0.9)
34
+ cucumber (>= 1.3.19)
35
+ ffi (~> 1.9.10)
36
+ rspec-expectations (>= 2.99)
37
+ thor (~> 0.19)
38
+ builder (3.2.2)
39
+ childprocess (0.5.9)
40
+ ffi (~> 1.0, >= 1.0.11)
41
+ concurrent-ruby (1.0.2)
42
+ concurrent-ruby (1.0.2-java)
43
+ contracts (0.13.0)
44
+ cucumber (1.3.20)
45
+ builder (>= 2.1.2)
46
+ diff-lcs (>= 1.1.3)
47
+ gherkin (~> 2.12)
48
+ multi_json (>= 1.7.5, < 2.0)
49
+ multi_test (>= 0.1.2)
50
+ diff-lcs (1.2.5)
51
+ docile (1.1.5)
52
+ ffi (1.9.10)
53
+ ffi (1.9.10-java)
54
+ gherkin (2.12.2)
55
+ multi_json (~> 1.3)
56
+ gherkin (2.12.2-java)
57
+ multi_json (~> 1.3)
58
+ i18n (0.7.0)
59
+ jdbc-sqlite3 (3.8.11.2)
60
+ json (1.8.6)
61
+ json (1.8.6-java)
62
+ minitest (5.9.1)
63
+ multi_json (1.11.2)
64
+ multi_test (0.1.2)
65
+ rake (10.5.0)
66
+ rspec (3.4.0)
67
+ rspec-core (~> 3.4.0)
68
+ rspec-expectations (~> 3.4.0)
69
+ rspec-mocks (~> 3.4.0)
70
+ rspec-core (3.4.2)
71
+ rspec-support (~> 3.4.0)
72
+ rspec-expectations (3.4.0)
73
+ diff-lcs (>= 1.2.0, < 2.0)
74
+ rspec-support (~> 3.4.0)
75
+ rspec-its (1.2.0)
76
+ rspec-core (>= 3.0.0)
77
+ rspec-expectations (>= 3.0.0)
78
+ rspec-mocks (3.4.1)
79
+ diff-lcs (>= 1.2.0, < 2.0)
80
+ rspec-support (~> 3.4.0)
81
+ rspec-support (3.4.1)
82
+ simplecov (0.11.2)
83
+ docile (~> 1.1.0)
84
+ json (~> 1.8)
85
+ simplecov-html (~> 0.10.0)
86
+ simplecov-html (0.10.0)
87
+ sqlite3 (1.3.12)
88
+ thor (0.19.1)
89
+ thread_safe (0.3.5)
90
+ thread_safe (0.3.5-java)
91
+ timecop (0.8.0)
92
+ tzinfo (1.2.2)
93
+ thread_safe (~> 0.1)
94
+ yard (0.8.7.6)
95
+
96
+ PLATFORMS
97
+ java
98
+ ruby
99
+
100
+ DEPENDENCIES
101
+ activerecord (>= 3.0.0)
102
+ activerecord-jdbcsqlite3-adapter
103
+ appraisal (~> 2.1.0)
104
+ aruba
105
+ cucumber (~> 1.3.15)
106
+ factory_girl!
107
+ jdbc-sqlite3
108
+ rspec (~> 3.0)
109
+ rspec-its (~> 1.0)
110
+ simplecov
111
+ sqlite3 (~> 1.3.10)
112
+ timecop
113
+ yard
114
+
115
+ BUNDLED WITH
116
+ 1.15.4
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2008-2017 Joe Ferris and thoughtbot, inc.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/NAME.md ADDED
@@ -0,0 +1,11 @@
1
+ # Why is this project called "Factory Girl"?
2
+
3
+ The name "Factory Girl" might be confusing to some developers who encounter this
4
+ library.
5
+
6
+ [We chose the name](https://robots.thoughtbot.com/waiting-for-a-factory-girl) as
7
+ a nod in the direction of the [Factory method](https://en.wikipedia.org/wiki/Factory_method_pattern)
8
+ and [Object Mother](http://martinfowler.com/bliki/ObjectMother.html) software
9
+ patterns from the _Design Patterns_ book, and as a reference to the
10
+ [Rolling Stones song](https://www.youtube.com/watch?v=4jKix2DFlnA) of the same
11
+ name.
data/NEWS ADDED
@@ -0,0 +1,290 @@
1
+ 4.8.1 (September 28, 2017)
2
+ Explicitly define `#destroyed?` within the `Stub` strategy to return `nil` instead of raising
3
+ Update various dependencies
4
+ Update internal test suite to use RSpec's mocking/stubbing instead of mocha
5
+
6
+ 4.8.0 (December 16, 2016)
7
+ Improve documentation
8
+ Add `FactoryGirl.generate_list` to be consistent with `build_list`/`create_list` and friends
9
+ Add `FactoryGirl.use_parent_strategy` configuration to allow associations to leverage parent build strategy
10
+
11
+ 4.7.0 (April 1, 2016)
12
+ Improve documentation
13
+ Improve instrumentation payload to include traits, overrides, and the factory itself
14
+ Allow linting of traits
15
+ Deprecate factory lookup by class name in preparation for 5.0
16
+ Improve internal performance by using flat_map instead of map and compact
17
+ Improve handling of dirty attributes after building a stubbed object
18
+ Reduce warnings from redefining methods
19
+
20
+ 4.6.0 (skipped)
21
+
22
+ 4.5.0 (October 17, 2014)
23
+ Improve FactoryGirl.lint by including exception and message in output
24
+ Allow selective linting
25
+ Use more explicit #public_send when doing attribute assignment
26
+ Improve documentation around FactoryGirl.lint and initialize_with
27
+ Deprecate #ignore in favor of #transient
28
+
29
+ 4.4.0 (February 10, 2014)
30
+ Add FactoryGirl.lint
31
+ Fix memory leak in duplicate traits
32
+ Update documentation
33
+
34
+ 4.3.0 (November 3, 2013)
35
+ Start testing against Rails 4.0 and Ruby 2.0.0
36
+ Stop testing against Rails 3.0 and Ruby 1.9.2
37
+ Add *_pair methods to only build two objects
38
+ Raise if a method is defined with a FactoryGirl block (factory or trait)
39
+ Allow use of Symbol#to_proc in callbacks
40
+ Add global callbacks
41
+ Improve GETTING_STARTED and README
42
+
43
+ 4.2.0 (January 18, 2013)
44
+ Improve documentation
45
+ Allow *_list syntax methods to accept a block
46
+ Update gem dependencies
47
+ Allow setting id for objects created with `build_stubbed`
48
+ Fix Stub strategy to mimic ActiveRecord regarding `created_at`
49
+ Evaluate sequences within the context of an Evaluator
50
+ Fix Mocha deprecation warning
51
+ Fix some warnings when running RUBYOPT=-w rake
52
+ Convert test suite to RSpec's "expect" syntax
53
+
54
+ 4.1.0 (September 11, 2012)
55
+ Allow multiple callbacks to bind to the same block
56
+ Fix documentation surrounding the stub strategy
57
+
58
+ 4.0.0 (August 3, 2012)
59
+ Remove deprecated cucumber_steps
60
+ Remove deprecated alternate syntaxes
61
+ Deprecate duplicate_attribute_assignment_from_initialize_with, which is now unused
62
+ as attributes assigned within initialize_with are not subsequently assigned
63
+
64
+ 3.6.1 (August 2, 2012)
65
+ Update README to include info about running with JRuby
66
+ Update dependencies on RSpec and tiny versions of Rails in Appraisal
67
+ Improve flexibility of using traits with associations and add documentation
68
+ Stub update_column to raise to mirror ActiveRecord's change from update_attribute
69
+
70
+ 3.6.0 (July 27, 2012)
71
+ Code/spec cleanup
72
+ Allow factories with traits to be used in associations
73
+ Refactor Factory to use DefinitionHierarchy to handle managing callbacks,
74
+ custom constructor, and custom to_create
75
+ Add memoization to speed up factories providing attribute overrides
76
+ Add initial support of JRuby when running in 1.9 mode
77
+ Improve docs on what happens when including FactoryGirl::Syntax::Methods
78
+
79
+ 3.5.0 (June 22, 2012)
80
+ Allow created_at to be set when using build_stubbed
81
+ Deprecate FactoryGirl step definitions
82
+
83
+ 3.4.2 (June 19, 2012)
84
+ Fix bug in traits with callbacks called implicitly in factories whose
85
+ callbacks trigger multiple times
86
+
87
+ 3.4.1 (June 18, 2012)
88
+ Fix traits so they can be nested and referred to from other traits
89
+
90
+ 3.4.0 (June 11, 2012)
91
+ Sequences support Enumerators
92
+ Optionally disable duplicate assignment of attributes in initialize_with
93
+ Make hash of public attributes available in initialize_with
94
+ Support referring to a factory based on class name
95
+
96
+ 3.3.0 (May 13, 2012)
97
+ Allow to_create, skip_create, and initialize_with to be defined globally
98
+ Allow to_create, skip_create, and initialize_with to be defined within traits
99
+ Fix deprecation messages for alternate syntaxes (make, generate, etc.)
100
+ Improve library documentation
101
+ Deprecate after_build, after_create, before_create, after_stub in favor of new callbacks
102
+ Introduce new callback syntax: after(:build) {}, after(:custom) {}, or callback(:different) {}
103
+ This allows for declaring any callback, usable with custom strategies
104
+ Add attributes_for_list and build_stubbed_list with the StrategySyntaxMethodRegistrar
105
+ Allow use of syntax methods (build, create, generate, etc) implicitly in callbacks
106
+ Internal refactoring of a handful of components
107
+
108
+ 3.2.0 (April 24, 2012)
109
+ Use AS::Notifications for pub/sub to track running factories
110
+ Call new within initialize_with implicitly on the build class
111
+ Skip to_create with skip_create
112
+ Allow registration of custom strategies
113
+ Deprecate alternate syntaxes
114
+ Implicitly call factory_girl's syntax methods from dynamic attributes
115
+
116
+ 3.1.0 (April 6, 2012)
117
+ Sequences support aliases, which reference the same block
118
+ Update documentation
119
+ Add before_create callback
120
+ Support use of #attribute_names method to determine available attributes for steps
121
+ Use ActiveSupport::Deprecation for all deprecations
122
+
123
+ 3.0.0 (March 23, 2012)
124
+ Deprecate the vintage syntax
125
+ Remove Rails 2.x support
126
+ Remove Ruby 1.8 support
127
+ Remove deprecated features, including default_strategy, factory_name,
128
+ :method for defining default strategy, ignore on individual attributes, and
129
+ interacting with Factory the way you would FactoryGirl
130
+
131
+ 2.6.4 (March 16, 2012)
132
+ Do not ignore names of transient attributes
133
+ Ensure attributes set on instance are calculated uniquely
134
+
135
+ 2.6.3 (March 9, 2012)
136
+ Fix issue with traits not being present the first time a factory is accessed
137
+ Update available Cucumber step definitions to not require a trailing colon
138
+ when building a table of attributes to instantiate records with
139
+
140
+ 2.6.2 (March 9, 2012)
141
+ Allow factories to use all their ancestors' traits
142
+ Ignore bin dir generated by bundler
143
+ Namespace ::Factory as top-level to fix vintage syntax issue with
144
+ Ruby 1.9.2-p3p18
145
+
146
+ 2.6.1 (March 2, 2012)
147
+ Use FactoryGirl.reload in specs
148
+ Clean up running named factories with a particular strategy with
149
+ FactoryGirl::FactoryRunner
150
+
151
+ 2.6.0 (February 17, 2012)
152
+ Improve documentation of has_many associations in the GETTING_STARTED
153
+ document
154
+ Deprecate :method in favor of :strategy when overriding an association's
155
+ build strategy
156
+
157
+ 2.5.2 (February 10, 2012)
158
+ Fix step definitions to use associations defined in parent factories
159
+ Add inline trait support to (build|create)_list
160
+ Update ActiveSupport dependency to >= 2.3.9, which introduced
161
+ class_attribute
162
+
163
+ 2.5.1 (February 3, 2012)
164
+ Fix attribute evaluation when the attribute isn't defined in the factory but
165
+ is a private method on Object
166
+ Update rubygems on Travis before running tests
167
+ Fix spec name
168
+ Update GETTING_STARTED with correct usage of build_stubbed
169
+ Update README with more info on initialize_with
170
+ Honor :parent on factory over block nesting
171
+
172
+ 2.5.0 (January 20, 2012)
173
+ Revert 'Deprecate build_stubbed and attributes_for'
174
+ Implement initialize_with to allow overriding object instantiation
175
+ Ensure FG runs against Rails 3.2.0
176
+
177
+ 2.4.2 (January 18, 2012)
178
+ Fix inline traits' interaction with defaults on the factory
179
+
180
+ 2.4.1 (January 17, 2012)
181
+ Deprecate build_stubbed and attributes_for
182
+ Fix inline traits
183
+
184
+ 2.4.0 (January 13, 2012)
185
+ Refactor internals of FactoryGirl to use anonymous class on which attributes
186
+ get defined
187
+ Explicitly require Ruby 1.8.7 or higher in gemspec
188
+ Fix documentation
189
+ Add Gemnasium status to documentation
190
+ Supplying a Class to a factory that overrides to_s no longer results in
191
+ getting the wrong Class constructed
192
+ Be more agnostic about ORMs when using columns in FactoryGirl step
193
+ definitions
194
+ Test against Active Record 3.2.0.rc2
195
+ Update GETTING_STARTED to use Ruby syntax highlighting
196
+
197
+ 2.3.2 (November 26, 2011)
198
+ Move logic of where instance.save! is set to Definition
199
+ Fix method name from aliases_for? to alias_for?
200
+ Refactor internal attribute handling to use an anonymous class instead of
201
+ faking Ruby's variable resolution. This allows for more sane usage of
202
+ attributes without having to manage sorting priority because attributes
203
+ can turn themselves into procs, which are used with define_method on a
204
+ class so attributes work correctly all the time.
205
+
206
+ 2.3.1 (November 23, 2011)
207
+ Remove internally-used associate method from all the FactoryGirl::Proxy subclasses
208
+ Move around requiring of files
209
+ Consolidate errors into factory_girl.rb
210
+ Refactor AttributeList to deal with priority only when iterating over
211
+ attributes
212
+ Refactor internals of some of the Proxy subclasses
213
+ Ensure callbacks on traits are executed in the correct order
214
+
215
+ 2.3.0 (November 18, 2011)
216
+ Registries are named, resulting in better messages when factories, traits,
217
+ or sequences cannot be found
218
+ Fix incorrect tests
219
+ Internals refactoring introducing FactoryGirl::NullFactory,
220
+ FactoryGirl::Definition, and FactoryGirl::DeclarationList
221
+ Use ActiveSupport for Hash#except and its delegation capabilities
222
+ Fix usage of callbacks when added via implicit traits
223
+ Use Bundler tasks and clean up dependencies
224
+ Fix failing spec for big letters in factory name passed as symbol
225
+ Add ability for traits to be added dynamically when creating an instance via
226
+ build, create, build_stubbed, or attributes_for
227
+
228
+ 2.2.0 (October 14, 2011)
229
+ Clean up RSpec suite to not use 'should'
230
+ Use create_list in step definitions
231
+ Syntax methods that deal with ORM interaction (attributes_for, build, build_stubbed,
232
+ and create) now accept a block that yields the result. This results in a
233
+ more convenient way to interact with the result than using Object.tap.
234
+ Standardize deprecation warnings
235
+ Update transient attribute syntax to use blocks instead of calling ignore on
236
+ each attribute declaration
237
+ Parents can be defined after children because factories are evaluated when
238
+ they're used; this means breaking up factories across multiple files will
239
+ behave as expected
240
+ Large internal refactoring, including changing access modifiers for a
241
+ handful of methods for a more clearly defined API
242
+
243
+ 2.1.2 (September 23, 2011)
244
+ Bugfix: Vintage syntax fixed after bug introduced in 2.1.1
245
+ Introduce dependency on activesupport to remove code from Factory class
246
+
247
+ 2.1.1 (September 23, 2011) (yanked)
248
+ Bugfix: Parent object callbacks are run before child object callbacks
249
+ Declarations: allow overriding/modification of individual traits in child factories
250
+ Callbacks refactored to not be attributes
251
+ Updating documentation for formatting and clarity (incl. new specificity for cucumber)
252
+
253
+ 2.1.0 (September 02, 2011)
254
+ Bugfix: created_at now defined for stubbed models
255
+ Gemspec updated for use with Rails 3.1
256
+ Factories can now be modified post-definition (useful for overriding defaults from gems/plugins)
257
+ All factories can now be reloaded with Factory.reload
258
+ Add :method => build to factory associations to prevent saving of associated objects
259
+ Factories defined in {Rails.root}/factories are now loaded by default
260
+ Various documentation updates
261
+
262
+ 1.1.4 (November 28, 2008)
263
+ Factory.build now uses Factory.create for associations of the built object
264
+ Factory definitions are now detected in subdirectories, such as
265
+ factories/person_factory.rb (thanks to Josh Nichols)
266
+ Factory definitions are now loaded after the environment in a Rails project
267
+ (fixes some issues with dependencies being loaded too early) (thanks to
268
+ Josh Nichols)
269
+ Factory names ending in 's' no longer cause problems (thanks to Alex Sharp
270
+ and Josh Owens)
271
+
272
+ 1.1.3 (September 12, 2008)
273
+ Automatically pull in definitions from factories.rb, test/factories.rb, or
274
+ spec/factories.rb
275
+ 1.1.2 (July 30, 2008)
276
+ Improved error handling for invalid and undefined factories/attributes
277
+ Improved handling of strings vs symbols vs classes
278
+ Added a prettier syntax for handling associations
279
+ Updated documentation and fixed compatibility with Rails 2.1
280
+
281
+ 1.1.1 (June 23, 2008)
282
+ The attribute "name" no longer requires using #add_attribute
283
+
284
+ 1.1.0 (June 03, 2008)
285
+ Added support for dependent attributes
286
+ Fixed the attributes_for build strategy to not build associations
287
+ Added support for sequences
288
+
289
+ 1.0.0 (May 31, 2008)
290
+ First version
data/README.md ADDED
@@ -0,0 +1,98 @@
1
+ # factory_girl [![Build Status](https://travis-ci.org/thoughtbot/factory_girl.svg)](http://travis-ci.org/thoughtbot/factory_girl?branch=master) [![Dependency Status](https://gemnasium.com/thoughtbot/factory_girl.svg)](https://gemnasium.com/thoughtbot/factory_girl) [![Code Climate](https://codeclimate.com/github/thoughtbot/factory_girl/badges/gpa.svg)](https://codeclimate.com/github/thoughtbot/factory_girl)
2
+
3
+ factory_girl is a fixtures replacement with a straightforward definition syntax, support for multiple build strategies (saved instances, unsaved instances, attribute hashes, and stubbed objects), and support for multiple factories for the same class (user, admin_user, and so on), including factory inheritance.
4
+
5
+ If you want to use factory_girl with Rails, see
6
+ [factory_girl_rails](https://github.com/thoughtbot/factory_girl_rails).
7
+
8
+ _[Interested in the project name?](NAME.md)._
9
+
10
+ Documentation
11
+ -------------
12
+
13
+ You should find the documentation for your version of factory_girl on [Rubygems](https://rubygems.org/gems/factory_girl).
14
+
15
+ See [GETTING_STARTED] for information on defining and using factories. We also
16
+ have [a detailed introductory video][], available for free on Upcase.
17
+
18
+ [a detailed introductory video]: https://upcase.com/videos/factory-girl?utm_source=github&utm_medium=open-source&utm_campaign=factory-girl
19
+
20
+ Install
21
+ --------
22
+
23
+ Add the following line to Gemfile:
24
+
25
+ ```ruby
26
+ gem 'factory_girl'
27
+ ```
28
+
29
+ and run `bundle install` from your shell.
30
+
31
+ To install the gem manually from your shell, run:
32
+
33
+ ```shell
34
+ gem install factory_girl
35
+ ```
36
+
37
+ **Caveat:** As of ActiveSupport 5.0 and above, Ruby 2.2.2+ is required. Because
38
+ of Rubygems' dependency resolution when installing gems, you may see an error
39
+ similar to:
40
+
41
+ ```
42
+ $ gem install factory_girl
43
+ ERROR: Error installing factory_girl:
44
+ activesupport requires Ruby version >= 2.2.2.
45
+ ```
46
+
47
+ To bypass this, install a pre-5.0 version of ActiveSupport before installing
48
+ manually.
49
+
50
+ Supported Ruby versions
51
+ -----------------------
52
+
53
+ The factory_girl 3.x+ series supports MRI Ruby 1.9. Additionally, factory_girl
54
+ 3.6+ supports JRuby 1.6.7.2+ while running in 1.9 mode. See [GETTING_STARTED]
55
+ for more information on configuring the JRuby environment.
56
+
57
+ For versions of Ruby prior to 1.9, please use factory_girl 2.x.
58
+
59
+ More Information
60
+ ----------------
61
+
62
+ * [Rubygems](https://rubygems.org/gems/factory_girl)
63
+ * [Stack Overflow](http://stackoverflow.com/questions/tagged/factory-girl)
64
+ * [Issues](https://github.com/thoughtbot/factory_girl/issues)
65
+ * [GIANT ROBOTS SMASHING INTO OTHER GIANT ROBOTS](http://robots.thoughtbot.com/)
66
+
67
+ [GETTING_STARTED]: http://rubydoc.info/gems/factory_girl/file/GETTING_STARTED.md
68
+
69
+ Contributing
70
+ ------------
71
+
72
+ Please see [CONTRIBUTING.md](https://github.com/thoughtbot/factory_girl/blob/master/CONTRIBUTING.md).
73
+
74
+ factory_girl was originally written by Joe Ferris and is now maintained by Josh
75
+ Clayton. Many improvements and bugfixes were contributed by the [open source
76
+ community](https://github.com/thoughtbot/factory_girl/graphs/contributors).
77
+
78
+ License
79
+ -------
80
+
81
+ factory_girl is Copyright © 2008-2017 Joe Ferris and thoughtbot. It is free
82
+ software, and may be redistributed under the terms specified in the
83
+ [LICENSE](/LICENSE) file.
84
+
85
+ About thoughtbot
86
+ ----------------
87
+
88
+ ![thoughtbot](http://presskit.thoughtbot.com/images/thoughtbot-logo-for-readmes.svg)
89
+
90
+ factory_girl is maintained and funded by thoughtbot, inc.
91
+ The names and logos for thoughtbot are trademarks of thoughtbot, inc.
92
+
93
+ We love open source software!
94
+ See [our other projects][community] or
95
+ [hire us][hire] to design, develop, and grow your product.
96
+
97
+ [community]: https://thoughtbot.com/community?utm_source=github
98
+ [hire]: https://thoughtbot.com?utm_source=github
data/Rakefile ADDED
@@ -0,0 +1,36 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ require 'rake'
4
+ require 'appraisal'
5
+ require 'yard'
6
+ require 'rspec/core/rake_task'
7
+ require 'cucumber/rake/task'
8
+
9
+ Bundler::GemHelper.install_tasks
10
+
11
+ desc 'Default: run the specs and features.'
12
+ task default: %w(spec:unit spec:acceptance features)
13
+
14
+ namespace :spec do
15
+ desc "Run unit specs"
16
+ RSpec::Core::RakeTask.new('unit') do |t|
17
+ t.pattern = 'spec/{*_spec.rb,factory_girl/**/*_spec.rb}'
18
+ end
19
+
20
+ desc "Run acceptance specs"
21
+ RSpec::Core::RakeTask.new('acceptance') do |t|
22
+ t.pattern = 'spec/acceptance/**/*_spec.rb'
23
+ end
24
+ end
25
+
26
+ desc "Run the unit and acceptance specs"
27
+ task :spec => ['spec:unit', 'spec:acceptance']
28
+
29
+ Cucumber::Rake::Task.new(:features) do |t|
30
+ t.fork = true
31
+ t.cucumber_opts = ['--format', (ENV['CUCUMBER_FORMAT'] || 'progress')]
32
+ end
33
+
34
+ YARD::Rake::YardocTask.new do |t|
35
+ end
36
+
data/cucumber.yml ADDED
@@ -0,0 +1 @@
1
+ default: -r features features
@@ -0,0 +1,36 @@
1
+ $LOAD_PATH << File.expand_path("../lib", __FILE__)
2
+ require 'factory_girl/version'
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = %q{ffactory_girl}
6
+ s.version = FactoryGirl::VERSION
7
+ s.summary = %q{ffactory_girl provides a framework and DSL for defining and
8
+ using model instance factories.}
9
+ s.description = %q{ffactory_girl provides a framework and DSL for defining and
10
+ using factories - less error-prone, more explicit, and
11
+ all-around easier to work with than fixtures.}
12
+
13
+ s.files = `git ls-files`.split("\n").reject { |f| f.match(%r{^(spec|features)/}) }
14
+
15
+ s.require_path = 'lib'
16
+ s.required_ruby_version = Gem::Requirement.new(">= 1.9.2")
17
+
18
+ s.authors = ["Josh Clayton", "Joe Ferris"]
19
+ s.email = ["jclayton@thoughtbot.com", "jferris@thoughtbot.com"]
20
+
21
+ s.homepage = "https://github.com/kalys/ffactory_girl"
22
+
23
+ s.add_dependency("activesupport", ">= 3.0.0")
24
+
25
+ s.add_development_dependency("rspec", "~> 3.0")
26
+ s.add_development_dependency("rspec-its", "~> 1.0")
27
+ s.add_development_dependency("cucumber", "~> 1.3.15")
28
+ s.add_development_dependency("timecop")
29
+ s.add_development_dependency("simplecov")
30
+ s.add_development_dependency("aruba")
31
+ s.add_development_dependency("appraisal", "~> 2.1.0")
32
+ s.add_development_dependency("activerecord", ">= 3.0.0")
33
+ s.add_development_dependency("yard")
34
+
35
+ s.license = "MIT"
36
+ end
@@ -0,0 +1,10 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activerecord-jdbcsqlite3-adapter", :platforms => :jruby
6
+ gem "jdbc-sqlite3", :platforms => :jruby
7
+ gem "sqlite3", "~> 1.3.10", :platforms => :ruby
8
+ gem "activerecord", :git => "https://github.com/rails/rails.git", :branch => "3-2-stable"
9
+
10
+ gemspec :path => "../"