Factory girl saving records in my development database

后端 未结 2 551
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-28 02:02

I have a very strange problem and I don\'t know where I should look to find it. I am developing a rails 3 app using rspec and factory girl for testing. For some reason, whenever

相关标签:
2条回答
  • 2021-01-28 02:41

    db/Seeds.rb maybe...but I think that only runs on db:reset and db:seed

    0 讨论(0)
  • 2021-01-28 02:53

    I figured it out. In my Gemfile, I had:

    group :development, :test do
      gem 'capybara'
      gem "rspec-rails"
      gem "guard-rspec"
      gem "factory_girl_rails"
      ...
    end
    

    I moved factory girl out of this block onto its own line so it is in the test group only like this:

    gem 'factory_girl_rails', :group => :test
    

    No more problems

    0 讨论(0)
提交回复
热议问题