Skip to content
Commits on Feb 17, 2012
  1. @joshuaclayton

    Fix ignored attribute name

    joshuaclayton committed
  2. @joshuaclayton
  3. @joshuaclayton
Commits on Feb 10, 2012
  1. @joshuaclayton

    Proxy => Strategy

    joshuaclayton committed
Commits on Feb 8, 2012
  1. @weppos @joshuaclayton
Commits on Jan 29, 2012
  1. @carlosantoniodasilva
Commits on Jan 23, 2012
  1. @jferris
Commits on Jan 20, 2012
  1. @joshuaclayton

    Implement initialize_with to allow overriding object instantiation

    joshuaclayton committed
    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"] }
          initialize_with { User.construct_with_things(things) }
        factory :report_generator do
          ignore do
            name { "Generic Report" }
            data { {:foo => "bar", :baz => "buzz"} }
          initialize_with {, data) }
    Code recommendations
Commits on Jan 13, 2012
  1. @dasch @joshuaclayton
Commits on Nov 18, 2011
  1. @joshuaclayton

    Traits can be added to factories when the factory creates an instance

    joshuaclayton committed
    This allows for traits to be used with normal factories without having
    to name every single factory that uses one (or many) traits.
    So, instead of creating male_admin and female_admin factories:
        FactoryGirl.define do
          factory :user do
            trait(:admin)  { admin true }
            trait(:male)   { gender "Male" }
            trait(:female) { gender "Female" }
            factory :male_admin,   :traits => [:male, :admin]
            factory :female_admin, :traits => [:admin, :female]
    You could just create a user with those traits assigned:
        FactoryGirl.create(:user, :admin, :male)
        FactoryGirl.create(:user, :admin, :female)
    This can be combined with attribute overrides as expected.
        FactoryGirl.create(:user, :admin, :male,   :name => "John Doe")
        FactoryGirl.create(:user, :admin, :female, :name => "Jane Doe")
Commits on Nov 9, 2011
  1. @gabebw

    Use correct module in docs.

    gabebw committed
Commits on Oct 31, 2011
  1. @agronemann @joshuaclayton
Commits on Oct 14, 2011
  1. @justinko @joshuaclayton
Commits on Oct 9, 2011
  1. @joshuaclayton

    Change syntax for ignoring attributes to use block syntax instead of

    joshuaclayton committed
    calling ignore on individual declarations.
    Old syntax:
        factory :user do
          four { 2 + 2 }.ignore
          name { "John Doe#{" - Rockstar" if rockstar}" }
    New syntax:
        factory :user do
          ignore do
            rockstar true
            four     { 2 + 2 }
          name { "John Doe#{" - Rockstar" if rockstar}" }
Commits on Sep 23, 2011
  1. @joshuaclayton

    Introduce declarations

    Joe Ferris and Josh Clayton committed with joshuaclayton
    Declarations are another layer of abstraction between defining the
    factories via the DSL and compiling the factories and their attributes.
    Declarations know how to return their attribute(s), and running a
    factory compiles the declarations before building all attributes on the
    factory. This moves all the attribute compilation logic into one
    centralized location on the Factory instance, which means traits (and
    potentially other features down the road) can have individual attributes
    overridden within child factories or through FactoryGirl.modify
    Closes #205
Commits on Sep 16, 2011
  1. @gabebw
Commits on Sep 15, 2011
  1. @ovargas27
  2. @ovargas27
Commits on Sep 6, 2011
  1. @joshuaclayton
  2. @gabebw


    gabebw committed
  3. @gabebw
Commits on Sep 2, 2011
  1. @joshuaclayton
  2. @joshuaclayton

    Allow factories to be modified after they've been defined.

    Stephan Eckardt and Josh Clayton committed with joshuaclayton
    This adds `FactoryGirl.modify`, which allows for reopening of factories
    that've been defined elsewhere. Modifying a factory won't remove or
    change callbacks, only attributes.
Commits on Sep 1, 2011
  1. @joshuaclayton
Commits on Aug 30, 2011
  1. @gabebw

    Fix formatting.

    gabebw committed
Commits on Aug 26, 2011
  1. @mike-burns
Commits on Aug 25, 2011
  1. Now able to specify :method => :build in a factory's association.

    Jim Kingdon committed
    See issue #64.
  2. @betelgeuse

    Typo fix possbile to possible

    betelgeuse committed
Commits on Aug 20, 2011
  1. @joshuaclayton

    Add transient variables

    joshuaclayton committed
    Closes #142
    Closes #103
Commits on Aug 17, 2011
  1. @tomstuart
Commits on Aug 12, 2011
  1. @joshuaclayton
  2. @joshuaclayton

    Document attribute groups

    joshuaclayton committed
Commits on Jul 28, 2011
  1. @gabebw
Commits on Jul 25, 2011
  1. @huerlisi
Commits on Jul 4, 2011
  1. @joshuaclayton
Something went wrong with that request. Please try again.