Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Commits on Aug 2, 2012
  1. Joshua Clayton
Commits on Jul 27, 2012
  1. Joshua Clayton
  2. αλεx π Joshua Clayton

    Adding JRuby support to FactoryGirl

    ifesdjeen authored joshuaclayton committed
      JRuby are affected by inconsistent behavior of overriding
      #respond_to? that is causing an unconditional call to
      #respond_to_missing.
    
      Current change does not affect MRI users in any way,
      JRuby-specific things are wrapped into the RUBY_PLATFORM
      check.
    
      Adding docs, modifying gemspec and travis.yml to make factory_girl to pass on Travis.
    
      Wire up tests
Commits on Jul 14, 2012
  1. Prem Sichanugrist Joshua Clayton

    Fix FactoryGirl naming convention

    sikachu authored joshuaclayton committed
    So now, we'll always refer to this Gem as FactoryGirl, regardless of
    context. This commit is to make it consistence throughout the code base.
Commits on Jul 7, 2012
  1. Joshua Clayton
Commits on Jun 25, 2012
  1. Joshua Clayton
Commits on Jun 19, 2012
  1. Joshua Clayton
Commits on Jun 8, 2012
  1. Joshua Clayton
Commits on May 18, 2012
  1. Joshua Clayton

    Optionally disable duplicate assignment of attributes in initialize_with

    joshuaclayton authored
    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
Commits on May 12, 2012
  1. Joshua Clayton

    Allow initialize_with defined for all factories

    joshuaclayton authored
    This allows users to define initialize_with for every factory run through
    factory_girl.
    
        FactoryGirl.define do
          initialize_with { new("John Doe") }
        end
    
    If you want to override this default, set it per factory or in a trait
    (and include the trait).
    
    Closes #342
  2. Joshua Clayton

    Allow to_create defined for all factories

    joshuaclayton authored
    This allows users to define to_create for every factory run through
    factory_girl.
    
        FactoryGirl.define do
          to_create {|instance| instance.persist! }
        end
    
    If you want to override this default, set it per factory or in a trait
    (and include the trait).
    
    Closes #341
Commits on May 4, 2012
  1. Joshua Clayton

    Introduce new callback syntax

    Josh Clayton and Jason Draper authored joshuaclayton committed
    Instead of calling before_create, after_build, after_create, or
    after_stub, you can now call:
    
        before(:create) {|instance| instance.name = "overridden!" }
        after(:create)  {|instance| instance.name = "overridden!" }
        after(:build)   {|instance| instance.name = "overridden!" }
        after(:stub)    {|instance| instance.name = "overridden!" }
    
    Additionally, you can declare callbacks longhand:
    
        callback(:after_stub) {|instance| instance.name = "overridden!" }
    
    This allows for custom callbacks to be defined:
    
        callback(:custom_callback) {|instance| instance.name = "overridden!" }
    
    Which can then be used from a custom strategy:
    
        class CustomStrategy
          def association(runner); end
    
          def result(evaluation)
            evaluation.object.tap do |instance|
              evaluation.notify(:custom_callback, instance)
            end
          end
        end
    
        FactoryGirl.register_strategy(:custom, CustomStrategy)
    
    This would allow for calling:
    
        FactoryGirl.custom(:user)
    
    Which would return the user instance but execute the :custom_callback callback
    on the user instance first.
Commits on Apr 24, 2012
  1. Joshua Clayton
  2. Joshua Clayton
  3. Joshua Clayton
  4. Joshua Clayton

    Fix dashes

    joshuaclayton authored
  5. Joshua Clayton
  6. Joshua Clayton
  7. Joshua Clayton
Commits on Apr 20, 2012
  1. Joshua Clayton

    Add documentation to using syntax methods inside dynamic attributes

    Ben Zhang and Josh Clayton authored joshuaclayton committed
    Closes #355
Commits on Apr 19, 2012
  1. Mark Rushakoff
Commits on Apr 6, 2012
  1. Joshua Clayton

    Clean up

    joshuaclayton authored
  2. Kristian Mandrup Joshua Clayton
Commits on Mar 31, 2012
  1. Joshua Clayton
  2. Joshua Clayton
Commits on Mar 27, 2012
  1. Mike Subelsky
Commits on Mar 16, 2012
  1. Joshua Clayton

    Remove Rails 2 support

    joshuaclayton authored
Commits on Feb 17, 2012
  1. Joshua Clayton
  2. Joshua Clayton
  3. Joshua Clayton
Commits on Feb 10, 2012
  1. Joshua Clayton

    Proxy => Strategy

    joshuaclayton authored
Commits on Feb 8, 2012
  1. Simone Carletti Joshua Clayton
Commits on Jan 29, 2012
  1. Carlos Antonio da Silva
Commits on Jan 23, 2012
  1. Joe Ferris
Commits on Jan 20, 2012
  1. Joshua Clayton

    Implement initialize_with to allow overriding object instantiation

    joshuaclayton authored
    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
Something went wrong with that request. Please try again.