“佣金规格"每次都迁移数据库 [英] "rake spec" migrates the database every time

查看:41
本文介绍了“佣金规格"每次都迁移数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我通过 rake 运行任何 rspec 任务时,数据库似乎被删除和迁移,但如果我通过脚本/规范路径/to/spec 运行它们,则不会.有没有我可以设置的选项,使佣金规范不涉及数据库?

When I run any of the rspec tasks via rake, the database seems to be dropped and migrated, but if I run them via script/spec path/to/spec, it doesn't. Is there an option I can set so the rake spec doesn't touch the database?

推荐答案

它不应该运行任何迁移,只将 db/schema.rb 导入您的测试数据库.这是预期的行为,因此您的测试在运行之前使用数据库架构的新副本.您不希望它刷新测试数据库的理由是什么?

It shouldn't be running any migrations, only importing db/schema.rb into your test database. This is the expected behavior so your tests use a fresh copy of the database schema before they run. What is your reasoning for not wanting it to refresh the test database?

这篇关于“佣金规格"每次都迁移数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆