FactoryGirl screws up rake db:migrate process

后端 未结 4 1454
梦毁少年i
梦毁少年i 2020-12-04 18:00

I am doing TDD/BDD in Ruby on Rails 3 with Rspec (2.11.0) and FactoryGirl (4.0.0). I have a factory for a Category model:

FactoryGirl.define \"Category\" do         


        
4条回答
  •  心在旅途
    2020-12-04 18:50

    I think you need to have factory girl definition like that in Gemfile:

      gem 'factory_girl_rails', :require => false
    

    And then you just require it in your spec_helper.rb like that:

      require 'factory_girl_rails'
    

    This is the way I'm always using this gem. You don't need to require it in other places than spec_helper.rb. Your current desired approach is just wrong.

提交回复
热议问题