开发者

RSpec and testing Rails Gem

开发者 https://www.devze.com 2023-03-30 03:52 出处:网络
I\'m trying to set a testing framework for a rails engine. I have everything working, I generated the corresponding rspec file with:

I'm trying to set a testing framework for a rails engine. I have everything working, I generated the corresponding rspec file with:

rails g rspec:install

However everytime I want to add a rspec testing file with:

rails g integration_test blah

The RSpec doesn't take over and instead the standard unit testing framework of rails cre开发者_如何学Pythonates the corresponding files. Any thoughts on where the problem might be?


I solved that problem running rails g with --integration-tools option

rails g integration_test blah --integration-tools=rspec

I do not know how to set rspec as default tool.


I always add in my application.rb :

config.generators do |g|
  g.test_framework :rspec
end

That allows RSpec to replace Rails generator for tests.


you should put in application.rb:

    config.generators do |g|
      g.integration_tool :rspec
      g.test_framework :rspec
    end

source: rails configuration guide

0

精彩评论

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