1
0
Fork 0
mirror of https://github.com/thoughtbot/factory_bot.git synced 2022-11-09 11:43:51 -05:00
Commit graph

12 commits

Author SHA1 Message Date
Joshua Clayton
b339c8f109 Move all block execution for dynamic attributes to the anonymous_instance 2011-11-28 22:52:54 -05:00
Joshua Clayton
fba6f332fd Attributes have a to_proc method and are lazily evaluated on an
anonymous class
2011-11-25 21:59:43 -05:00
Joshua Clayton
3803be3846 Simplify Factory::Runner by always having attribute add_to(proxy) 2011-10-31 23:13:19 -04:00
Joshua Clayton
dc32fd69e8 Change syntax for ignoring attributes to use block syntax instead of
calling ignore on individual declarations.

Old syntax:

    factory :user do
      rockstar(true).ignore
      four { 2 + 2 }.ignore

      name { "John Doe#{" - Rockstar" if rockstar}" }
    end

New syntax:

    factory :user do
      ignore do
        rockstar true
        four     { 2 + 2 }
      end

      name { "John Doe#{" - Rockstar" if rockstar}" }
    end
2011-10-09 16:46:57 -04:00
Joshua Clayton
c87429b829 Add transient variables
Closes #142
Closes #103
2011-08-20 18:36:37 -04:00
Joshua Clayton
7c9254a452 Clean up attribute and core factory specs 2011-08-19 17:21:14 -04:00
Prem Sichanugrist
91d8614600 Use instance_exec instead of instance_eval
In Ruby 1.9.2, instance_eval doesn't yield self anymore, resulting in "wrong number of arguments" error. This should make it compatible with 1.8.7 and 1.9.2

References:
http://www.ruby-forum.com/topic/213313
http://www.ruby-forum.com/topic/189422
2011-05-25 17:55:09 -04:00
Joe Ferris
58ee31b91a Evaulate dynamic attribute blocks without arguments in the context of the proxy 2010-09-30 23:35:24 -04:00
Joe Ferris
8b4a6a1c3a Moved definition loading syntax out of the factory class; moved everything into a FactoryGirl module 2010-07-06 20:22:02 -04:00
Jason Morrison
e8ce6b9f26 Fixing the first Ruby 1.9 problem with calling a block that has an arity of zero or one
Signed-off-by: Nick Quaranto <nick@quaran.to>
2009-06-16 20:13:58 -04:00
Joe Ferris
fa3a555c19 Added an exception when defining a sequence from a dynamic attribute block [#43 state:resolved] 2009-04-13 21:39:34 -04:00
Joe Ferris
56e31cae8c Split static and dynamic attributes into separate classes 2009-01-02 17:33:00 -05:00