1
0
Fork 0
mirror of https://github.com/thoughtbot/factory_bot.git synced 2022-11-09 11:43:51 -05:00
Commit graph

6 commits

Author SHA1 Message Date
Oli Peate
01d81f54b5 Remove unnecessary spec_helper requires
https://github.com/rspec/rspec/wiki#rspec
2018-05-21 18:03:28 +01:00
Avielle
c716ce01b4 Replace 'girl' with 'bot' everywhere (#1051)
Also: add a deprecation warning to factory_girl, asking users to switch to
factory_bot

https://github.com/thoughtbot/factory_girl/issues/921
2017-10-20 15:20:28 -04:00
Cédric Boutillier
4a4a0b90f2 Upgrade RSpec and other testing gems 2016-02-07 00:14:25 -05:00
Joshua Clayton
ed598ec54c Update repo to follow thoughtbot guide for whitespace in blocks 2013-12-14 22:33:15 -05:00
Joshua Clayton
b095f24598 Convert to expect syntax 2013-01-18 13:58:36 -05:00
Derek Prior and Josh Clayton
bf29843d15 Evaluate sequences within the context of the Evaluator when possible
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
      end
    end

    FactoryGirl.define do
      factory :user do
        sequence(:job_title) {|n| "{title} #{n} at #{company.name}" }
      end
    end

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 }
      end
    end

[#466]
2013-01-18 09:33:54 -05:00