Cleanly uninstall Rspec and use vanilla Unit::Test in Rails 3.x

I was reading the Rails Tutorial and following along like a good drone installing everything the way it said and doing everything it told me. Then I realized I didn't like the book any more for a number of reasons and quit reading it. But I had already created my own project with Rspec installed as it told me to. Then I find out that Rspec is quite a bit more complicated than the built in Test::Unit and every other book I read is telling me how to use Test::Unit, including the excellent 'Rails Test Prescriptions' by Pragmatic. (I wish I'd started with them first.) Anywho, the book does teach Rspec a little bit but not until after you get past Test::Unit. Now I can't scrape Rspec out of my project. There is a 'rails generate rspec:install' but no uninstall and my tests now default to Rspec. I can force a unit test with 'rake test' but if I use 'rake' it goes to Rspec. There are other remnants of Rspec too, like in the --help for 'rails generate'. My concern is that as I get more involved with vanilla Test I'll find more problematic areas. I removed or renamed the files / folders generated by the installation. I also looked for changes to my config files but couldn't find any. I intend to consider Rspec down the road but for now I'd like to have a clean project to work with.


You probably already did this, but thought I would throw it out there just incase. Did you remove the RSpec references from you Gemfile?


You can do following,
1) Remove spec directory
2) Remove all rspec related gems (capybara, faker, etc.) from the Gemfile
3) Run 'bundle clean --force' command to remove all unused gems and then run 'bundle install' again
4) Now 'bundle list' should show you all the gems except rspec related


In config/application.rb , changed

require "active_model/railtie"
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
require "sprockets/railtie"
require "rails/test_unit/railtie"

to

require 'rails/all'
链接地址: http://www.djcxy.com/p/51652.html

上一篇: WPF标签边距

下一篇: 干净地卸载Rspec并在Rails 3.x中使用vanilla Unit :: Test