How do I run Rails integration tests without dropping DB contents?

后端 未结 4 1927
故里飘歌
故里飘歌 2021-01-02 04:22

I\'ve written some integration tests that I\'d like to run against a copy of my prod database before I push to production. This lets me test all of my routes are still corre

4条回答
  •  忘掉有多难
    2021-01-02 04:49

    Integration tests calls db:test:prepare which calls db:test:clone_structure which calls db:structure:dump and db:test:purge

    You can write your own task

    namespace :your_namespace do
      Rake::TestTask.new(:integration => "db:migrate(if you want") do |t|
        t.libs << "test"
        t.pattern = 'test/integration/**/*_test.rb'
        t.verbose = true
      end
    end
    

提交回复
热议问题