Skip to content
Commits on Apr 24, 2012
  1. @joshuaclayton
  2. @joshuaclayton
  3. @joshuaclayton

    Fix dashes

    joshuaclayton committed Apr 23, 2012
  4. @joshuaclayton
  5. @joshuaclayton
  6. @joshuaclayton
Commits on Apr 20, 2012
  1. @joshuaclayton

    Add documentation to using syntax methods inside dynamic attributes

    Ben Zhang and Josh Clayton committed with joshuaclayton Apr 20, 2012
    Closes #355
Commits on Apr 19, 2012
  1. @mark-rushakoff
Commits on Apr 6, 2012
  1. @joshuaclayton

    Clean up

    joshuaclayton committed Apr 6, 2012
  2. @kristianmandrup @joshuaclayton
Commits on Mar 31, 2012
  1. @joshuaclayton
  2. @joshuaclayton
Commits on Mar 27, 2012
  1. @subelsky
Commits on Mar 16, 2012
  1. @joshuaclayton

    Remove Rails 2 support

    joshuaclayton committed Mar 9, 2012
Commits on Feb 17, 2012
  1. @joshuaclayton

    Fix ignored attribute name

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

    Proxy => Strategy

    joshuaclayton committed Feb 8, 2012
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 Jan 20, 2012
    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
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 Nov 18, 2011
    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]
          end
        end
    
        FactoryGirl.create(:male_admin)
        FactoryGirl.create(:female_admin)
    
    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 Nov 9, 2011
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 Oct 7, 2011
    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
Commits on Sep 23, 2011
  1. @joshuaclayton

    Introduce declarations

    Joe Ferris and Josh Clayton committed with joshuaclayton Sep 23, 2011
    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

    typo

    gabebw committed Sep 6, 2011
  3. @gabebw
Something went wrong with that request. Please try again.