Rspec is using my development DB

后端 未结 5 1024
心在旅途
心在旅途 2021-02-05 13:32

I\'m using Rspec for testing. However, it uses my development DB instead of my test DB. How can this occur?

I simply use rspec to run my tests: don:my_project_root

5条回答
  •  没有蜡笔的小新
    2021-02-05 13:35

    I had a similar issue and despite having replaced ENV["RAILS_ENV"] = 'test' with Rails.env = 'test' in spec_helper.rb, I just have to manually specify RAILS_ENV=test when I run the command for it to work. Look here, but do try the Rails.env thing first:

    Bundle exec rake spec and custom rake tasks

提交回复
热议问题