Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Commits on Apr 26, 2013
  1. @olivierlacan @joshuaclayton

    Add an example of a trait used within a trait

    olivierlacan authored joshuaclayton committed
    Closes #518
Commits on Apr 5, 2013
  1. @releu @joshuaclayton

    Allow use of Symbol#to_proc in FactoryGirl callbacks

    releu authored joshuaclayton committed
    This allows callbacks to be called as such:
    
        FactoryGirl.define do
          factory :user do
            after :create, &:confirm!
          end
        end
    
    Closes #511
Commits on Mar 25, 2013
  1. @joshuaclayton
Commits on Feb 17, 2013
  1. @dpickett @joshuaclayton

    change reference from 'next' to 'generate'

    dpickett authored joshuaclayton committed
  2. @dpickett @joshuaclayton

    probable typo - missing interpolation #

    dpickett authored joshuaclayton committed
Commits on Feb 8, 2013
  1. @joshuaclayton

    Add global callbacks

    joshuaclayton authored
    This allows callbacks (after :build, :create, etc.) to be defined at the
    FactoryGirl level; this means that the callback will be invoked for all
    factories. This is primarily to maintain consistency and follow the
    principle of least surprise.
    
    As usual, callbacks are applied from the lowest component to the
    highest, meaning that global callbacks will be run after factory and
    trait callbacks are run.
    
        FactoryGirl.define do
          after(:build) {|object| puts "Built #{object}" }
    
          factory :user
          # ...
        end
    
    Closes #481
    Closes #486
Commits on Jan 18, 2013
  1. @joshuaclayton

    Convert to expect syntax

    joshuaclayton authored
Commits on Nov 2, 2012
  1. @hosamaly @joshuaclayton

    Re: #431 -- Added a note about `strategy: :build`

    hosamaly authored joshuaclayton committed
Commits on Oct 29, 2012
  1. @stve
Commits on Oct 22, 2012
  1. @pjg @joshuaclayton

    Two typos fix in GETTING_STARTED

    pjg authored joshuaclayton committed
Commits on Sep 28, 2012
  1. @phlipper
Commits on Sep 11, 2012
  1. @joshuaclayton

    Support binding a block to multiple callbacks

    joshuaclayton authored
    This allows for binding multiple callbacks (after_stub, before_create,
    etc.) to a single block. This is useful if you want a block to be called
    across all build strategies (since build_stubbed doesn't share any
    callbacks with build/create).
    
    Examples:
    
        factory :user do
          callback(:after_stub, :before_create) { do_something }
          after(:stub, :create) { do_something_else }
          before(:create, :custom) { do_a_third_thing }
        end
Commits on Aug 11, 2012
  1. @eostrom @joshuaclayton

    Fixed reference to "stub" build strategy.

    eostrom authored joshuaclayton committed
Commits on Aug 2, 2012
  1. @joshuaclayton

    Prep for FactoryGirl 4.0

    joshuaclayton authored
  2. @joshuaclayton
Commits on Jul 27, 2012
  1. @joshuaclayton
  2. @ifesdjeen @joshuaclayton

    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. @sikachu @joshuaclayton

    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. @joshuaclayton
Commits on Jun 25, 2012
  1. @joshuaclayton
Commits on Jun 19, 2012
  1. @joshuaclayton
Commits on Jun 8, 2012
  1. @joshuaclayton
Commits on May 18, 2012
  1. @joshuaclayton

    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. @joshuaclayton

    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. @joshuaclayton

    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. @joshuaclayton

    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. @joshuaclayton
  2. @joshuaclayton
  3. @joshuaclayton
  4. @joshuaclayton

    Fix dashes

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

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