Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Commits on Apr 16, 2015
  1. @joshuaclayton
  2. @joshuaclayton

    Test against Rails 4.2

    joshuaclayton authored
    * Update callbacks spec so column types reflect assignment
      Rails 4.2 introduces type coercion on attribute assignment instead of it
      occurring after persisting the record.
Commits on Nov 18, 2014
  1. @timdiggins @joshuaclayton

    correct error message when stubbed reload called with transaction loc…

    timdiggins authored joshuaclayton committed
    …k attr. Fixes #719
Commits on Oct 17, 2014
  1. @joshuaclayton
Commits on May 30, 2014
  1. @joshuaclayton

    Allow selective linting

    joshuaclayton authored
    Closes #653
Commits on May 29, 2014
  1. @joshuaclayton
Commits on May 23, 2014
  1. @iwz

    Deprecate `#ignore` in favor of `#transient`

    iwz authored
    Update documentation to reflect that transient is now preferred
Commits on Apr 19, 2014
  1. @fearoffish @joshuaclayton
Commits on Feb 8, 2014
  1. @joshuaclayton

    Add FactoryGirl.lint to ensure all factories are valid

    joshuaclayton authored
    This commit adds FactoryGirl.lint, which iterates over each defined
    factory, builds it, and ensures it is valid. If any factories are
    invalid, an exception is raised and includes the names of each invalid
Commits on Dec 15, 2013
  1. @joshuaclayton
Commits on Dec 13, 2013
  1. @greyblake @joshuaclayton
Commits on Nov 1, 2013
  1. @joshuaclayton

    Add *_pair methods to create only two records

    Andy Waite and Josh Clayton authored joshuaclayton committed
    This introduces a set of methods for each build strategy where only two
    records are created. Because the *_list methods can create an arbitrary
    number (often too high), this introduces *_pair to ensure only two
    records are created (and the number 2 doesn't need to be specified in
    the call).
Commits on Oct 8, 2013
  1. @joshuaclayton

    Fix factory named camel case string

    Fumiaki MATSUSHIMA authored joshuaclayton committed
  2. @PlugIN73 @joshuaclayton

    remove deprecation warnings

    PlugIN73 authored joshuaclayton committed
Commits on Jun 7, 2013
  1. @joshuaclayton

    Use instance_exec passing self as an argument for dynamic attributes

    joshuaclayton authored
    Calling `` means any implied scope of block evaluation
    goes out the window when an arity of 1 is used. This change uses
    `instance_exec`, passing along self as the argument for the block
    variable, meaning that the block is still invoked within the context of
    the FactoryGirl::Evaluator while allowing the variable to have access to
    the evaluator.
    Closes #529
Commits on Apr 26, 2013
  1. @joshuaclayton

    Raise if a method is defined with a FactoryGirl block (factory or trait)

    joshuaclayton authored
    This resolves an issue where users have defined methods inside factory
    girl blocks. This hasn't worked in quite a while and without raising,
    users would be able to define methods and see an odd error (a
    NoMethodError for `singleton_method_added=`). Instead, we raise
    immediately so that no issues come up later when they actually try to
    use the factories.
    Closes #513
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!
    Closes #511
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
          # ...
    Closes #481
    Closes #486
Commits on Jan 18, 2013
  1. @joshuaclayton

    Convert to expect syntax

    joshuaclayton authored
  2. @joshuaclayton

    Fix warnings

    joshuaclayton authored
    [Closes #463]
  3. @joshuaclayton
  4. @joshuaclayton

    Evaluate sequences within the context of the Evaluator when possible

    Derek Prior and Josh Clayton authored joshuaclayton committed
    This fixes weird issues where methods invoked within sequences
    (like `sprintf`) fail because these methods are being evaluated within
    the context of the DefinitionProxy. With this change, invoking `#next`
    on a sequence happens from the evaluator so if the scope is provided (it
    usually will be), it'll run in the proper context. This means a couple
    of oddities are fixed:
    1. Developers can now refer to methods on the object instance, just like
    in dynamic attributes:
        class User
          def company
            # company lookup
        FactoryGirl.define do
          factory :user do
            sequence(:job_title) {|n| "{title} #{n} at #{}" }
    2. Invoke methods typically available because the method is available on
    Object (e.g. Kernel methods):
        FactoryGirl.define do
          factory :user do
            sequence(:last_4_ssn) {|n| sprintf '%04d', n }
Commits on Dec 21, 2012
  1. @aripollak @joshuaclayton

    Match build_stubbed's created_at type to ActiveRecord

    aripollak authored joshuaclayton committed
    Closes #469
Commits on Nov 7, 2012
  1. @joshuaclayton
Commits on Oct 22, 2012
  1. @jferris @joshuaclayton

    Refactor spec to avoid a general fixture

    jferris authored joshuaclayton committed
    * Removes let blocks
    * Introduces factory methods for common test setup
  2. @bbugh @joshuaclayton
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).
        factory :user do
          callback(:after_stub, :before_create) { do_something }
          after(:stub, :create) { do_something_else }
          before(:create, :custom) { do_a_third_thing }
Commits on Aug 2, 2012
  1. @joshuaclayton

    Prep for FactoryGirl 4.0

    joshuaclayton authored
  2. @joshuaclayton
  3. @joshuaclayton
Commits on Jul 24, 2012
  1. @joshuaclayton
Commits on Jun 29, 2012
  1. @joshuaclayton

    Allow factories with traits to be used in associations

    joshuaclayton authored
    This allows defining associations with factories using traits by slicing
    up the hash passed to association. Passing an array to `:factory` will
    use the first item in the array as the factory, with any subsequent
    symbols as traits.
    Here's an example:
        factory :post do
          association :author, factory: [:user, :admin], name: 'John Doe'
    Closes #395
Commits on Jun 22, 2012
  1. @joshuaclayton
  2. @joshuaclayton
Commits on Jun 20, 2012
  1. @joshuaclayton
Something went wrong with that request. Please try again.