简体   繁体   中英

Use rspec only in integration tests

I have a project which works well with rails default test suite Test::Unit and I have no reason to change the tests I have written. But when I write integration test with capybara, I found that capybara always work with rspec and I have some problem when using capybara with Test::Unit. So i decide to use rspec in Integration Test.

But here is the problem. After running rails g rspec:install the cmd rails g model will create test in spec, how can i use rspec for only integration test and use Test::Unit in other test.

Thanks in advance.

I assume you installed the rspec-rails gem. The gem configures Rails to use RSpec for testing . Generator are usually run in development, so by scoping rspec-rails to a :test group in your Gemfile , Rails should not load the gem in development.

group :test do
  gem 'rspec-rails'
end

You could also overwrite the settings set by rspec-rails after the gem was loaded.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM