title: Factory Girl undefined method for nil:NilClass
body: <p>I have a controller spec something like this</p>
  
  <pre><code>describe :bizzaro_controller do
  
    let(:credit_card_account) { FactoryGirl.build :credit_card_account }
  
    it "doesn't blow up with just the stub" do
      CreditCardAccount.stub(:new).and_return(credit_card_account)
    end
  
    it "doesn't blow up" do
      credit_card_account
      CreditCardAccount.stub(:new).and_return(credit_card_account)
    end
  
  end
  </code></pre>
  
  <p>Which results in this:</p>
  
  <pre><code>bizzaro_controller
    doesn't blow up with just the stub (FAILED - 1)
    doesn't blow up
  
  Failures:
  
    1) bizzaro_controller doesn't blow up
       Failure/Error: let(:credit_card_account) { FactoryGirl.build :credit_card_account }
       NoMethodError:
         undefined method `exp_month=' for nil:NilClass
       # ./spec/controllers/user/bizzareo_controller_spec.rb:5:in `block (2 levels) in &lt;top (required)&gt;'
       # ./spec/controllers/user/bizzareo_controller_spec.rb:9:in `block (3 levels) in &lt;top (required)&gt;'
  
  Finished in 0.23631 seconds
  2 examples, 1 failure
  </code></pre>
  
  <p>My credit card factory looks like this:</p>
  
  <pre><code>FactoryGirl.define do
    factory :credit_card_account do
      exp_month 10
      exp_year 2075
      number '3'
    end
  end
  </code></pre>
  
  <p>My CreditCardAccount is an empty ActiveRecord::Base model</p>
  
  <pre><code>=&gt; CreditCardAccount(id: integer, exp_month: integer, exp_year: integer, number: string)
  </code></pre>
  
  <p>Versions</p>
  
  <pre><code>0 HAL:0 work/complex_finance % bundle show rails rspec-rails factory_girl
  /home/brundage/.rvm/gems/ruby-2.0.0-p247@complex_finance/gems/rails-4.0.0
  /home/brundage/.rvm/gems/ruby-2.0.0-p247@complex_finance/gems/rspec-rails-2.14.0
  /home/brundage/.rvm/gems/ruby-2.0.0-p247@complex_finance/gems/factory_girl-4.2.0
  </code></pre>