Avielle
c716ce01b4
Replace 'girl' with 'bot' everywhere ( #1051 )
...
Also: add a deprecation warning to factory_girl, asking users to switch to
factory_bot
https://github.com/thoughtbot/factory_girl/issues/921
2017-10-20 15:20:28 -04:00
Bob Umerkulov
23c0dc67b5
Replace map.flatten with flat_map
2014-11-13 23:53:09 -05:00
Joshua Clayton
a8bccdfc9b
Use #public_send for attribute assignment
...
Closes #646
2014-05-29 15:37:03 -04:00
Joshua Clayton
ed598ec54c
Update repo to follow thoughtbot guide for whitespace in blocks
2013-12-14 22:33:15 -05:00
Joshua Clayton
e9d9e3099b
Prep for FactoryGirl 4.0
2012-08-02 11:17:39 -04:00
Joshua Clayton
acb2636321
Memoize the names of attributes to assign for a 33% speed increase on factories with overrides
2012-07-25 09:13:25 -04:00
Joshua Clayton
8209a461ee
Remove dependency on build_class in Evaluator
2012-07-24 18:50:11 -04:00
Joshua Clayton
9bc8e50b44
Refer to the correct attribute
2012-06-08 17:06:19 -04:00
Joshua Clayton
2b50190a07
Make hash of public attributes available within the initialize_with block
...
Closes #344
2012-06-08 17:05:36 -04:00
Joshua Clayton
a5b3a97c9d
Optionally disable duplicate assignment of attributes in initialize_with
...
By setting:
FactoryGirl.duplicate_attribute_assignment_from_initialize_with =
false
This turns off duplicate assignment of attributes accessed from
initialize_with. This means any attributes accessed from the factory and
assigned in the initialize_with block won't be subsequently set after
the object has been instantiated.
This will be the default functionality in 4.0.
Closes #345
2012-05-18 17:38:23 -04:00
Joshua Clayton
f1fd650048
Clean up documentation
2012-05-05 02:31:31 -04:00
Joshua Clayton
b84ccd9d09
Add AttributeList#names to map all names for attributes in the list
2012-04-24 16:40:29 -05:00
Joshua Clayton
a16e5eb22e
Move ignored/non-ignored filtering logic to AttributeList
2012-04-24 16:20:44 -05:00
Joshua Clayton
0aadd703a5
Follow Ruby conventions of double-under's on each side of the method name
2012-04-20 22:33:54 -04:00
Joshua Clayton
29a5ab1a89
Implicitly call FactoryGirl's syntax methods from dynamic attributes
2012-04-20 16:00:23 -04:00
Joshua Clayton
f5d4db1085
Ensure attributes set on instance are calculated uniquely
...
This fixes a bug where assignment occurs multiple times; in the case of
nested attributes, assignment mutates the instance, meaning that it
occurring multiple times will cause issues.
Closes #314
2012-03-16 13:04:31 -04:00
Ian Duggan
0d7520e825
Do not ignore alias names of transient attributes. ( Fixes #311 )
...
https://github.com/thoughtbot/factory_girl/issues/311
2012-03-13 17:14:42 -07:00
Joshua Clayton
578036480f
Implement initialize_with to allow overriding object instantiation
...
Factory Girl now allows factories to override object instantiation. This
means factories can use factory methods (e.g. methods other than new) as
well as pass arguments explicitly.
factory :user do
ignore do
things { ["thing 1", "thing 2"] }
end
initialize_with { User.construct_with_things(things) }
end
factory :report_generator do
ignore do
name { "Generic Report" }
data { {:foo => "bar", :baz => "buzz"} }
end
initialize_with { ReportGenerator.new(name, data) }
end
Whitespace
Code recommendations
2012-01-20 15:37:36 -05:00
Joshua Clayton
40242e903b
Don't require AS's basic object
2012-01-13 14:20:16 -05:00
Joshua Clayton
f2e41389ea
Factory evaluators use inheritance
2012-01-09 17:28:20 -05:00
Joshua Clayton
1c7eab13d6
Add NullObject
2012-01-08 00:23:25 -05:00
Joshua Clayton
d9e0372345
Mimic BasicObject without using BasicObject
2012-01-07 22:52:59 -05:00
Joshua Clayton
d918c1ddae
Allow methods to be called from the instance in factory girl attributes
...
This fixes a regression introduced with the introduction of the
anonymous class.
Closes #264
2012-01-07 22:13:38 -05:00
Joshua Clayton
7254a81072
Add AttributeList#associations
2011-12-30 01:01:04 -05:00
Joshua Clayton
7a8dcd2c37
Clean up block variable name
2011-12-30 01:00:33 -05:00
Joshua Clayton
d1207cda75
Clean up method name
2011-12-30 00:41:50 -05:00
Joshua Clayton
105e892dd2
Get aliases working
2011-12-30 00:41:50 -05:00
Joshua Clayton
410b26c934
Remove unused #set from Proxy::AttributesFor
2011-12-30 00:41:49 -05:00
Joshua Clayton
d3f6090a8f
Expose @overrides through a instance method
2011-12-30 00:41:49 -05:00
Joshua Clayton
2e15a3f429
Change ivar name
2011-12-30 00:41:49 -05:00
Joshua Clayton
9cee12a8dc
WIP: Remove runner and get acceptance tests green
2011-12-30 00:41:48 -05:00
Joshua Clayton
3eccbc5de0
Add AttributeAssigner to handle attribute assignment on the build class instance
2011-12-30 00:41:48 -05:00