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

前端 未结 7 1323
谎友^
谎友^ 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:14

    1. copy the seed.rb file inside the config/initializers folder.So seed.rb file will be executed on server start.

    2. Run the below command to fill the test db with the seed.rb data

      RAILS_ENV=test rake db:seed

提交回复
热议问题