开发者

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

开发者 https://www.devze.com 2022-12-18 10:23 出处:网络
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 migrat

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

精彩评论

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