Auto-load the seed data from db/seeds.rb with rake

前端 未结 7 1320
谎友^
谎友^ 2020-12-14 08:17

I\'m using rails-rspec gem and I have several specs (models, controllers, etc). When I run:

bundle exec rake

everything is te

7条回答
  •  时光取名叫无心
    2020-12-14 09:18

    Depending on how your seed file is configured, you might just be able to load/run it from a before(:each) or before(:all) block:

    load Rails.root + "db/seeds.rb" 
    

提交回复
热议问题