开发者

Ruby on Rails Rspec migrates database when running rake spec:plugins

I'm trying to开发者_运维问答 test a plugin that i wrote by running:

rake spec:plugins

When i execute this command it appears that it drops my database tables (in my test DB) and then runs a migration without any plugins loaded to give me a clean database. This would normally be fine, but I am using a plugin that allows me to set index length limits for MYSQL, so if I run a migration without that plugin, then i get a syntax error. This means that i cannot test my plugin with the rspec rake command.

I can't find any documentation for this command, is there a way to get it to not run any migrations before it executes?


Try setting this in your plugin spec:

Spec::Runner.configure do |config|
  config.use_transactional_fixtures = false
end

Of course this means you have to ensure the test DB is in the correct state for your tests, and that you clean up any modifications on exit.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜