How can I tell Rails to use RSpec instead of test-unit when creating a new Rails app?

后端 未结 5 582
遥遥无期
遥遥无期 2021-01-29 20:51

I have test-unit installed and rspec installed (along with -core, -expectations, -mocks and -rails

5条回答
  •  执念已碎
    2021-01-29 21:22

    Create your new rails application as:

    rails new  -T
    

    Or remove your test directory from your existing application:

    rm -rf test/
    

    Make an entry in your Gemfile:

    gem 'rspec-rails'
    

    From the command line install the gem

    $ bundle install
    

    From the command line install rspec into your application:

    $ rails g rspec:install
    

    Now your rails application uses RSpec instead of test-unit.

提交回复
热议问题