This project is archived and is in readonly mode.
Hide test_unit generators when other frameworks are assigned as test_framework
-
Neeraj Singh
- Importance changed from to Low
I added following line to application.rb . However I am not seeing respec:install as one of the options. Did something change between this ticket and rails edge.
module Demo class Application < Rails::Application config.generators.test_framework = :rspec end end $ rails g Usage: rails generate GENERATOR [args] [options] General options: -h, [--help] # Print generator's options and usage -p, [--pretend] # Run but do not make any changes -f, [--force] # Overwrite files that already exist -s, [--skip] # Skip files that already exist -q, [--quiet] # Suppress status output Please choose a generator below. Rails: controller generator helper integration_test mailer migration model observer performance_test plugin resource scaffold scaffold_controller session_migration stylesheets TestUnit: test_unit:controller test_unit:helper test_unit:integration test_unit:mailer test_unit:model test_unit:observer test_unit:performance test_unit:plugin test_unit:scaffold $ gem list rspec *** LOCAL GEMS *** rspec (1.3.0) rspec-rails (1.3.2) -
David Chelimsky
Gotta have rspec-2, which is still in beta. Add this to your Gemfile:
gem "rspec-rails", ">= 2.0.0.beta.20" -
Rohit Arondekar
What if the other test framework doesn't have some generators, then it would be nice to have the fall backs listed. Anybody agree?
-
David Chelimsky
Do you mean show the test_unit versions for only those that are missing?
-
Rohit Arondekar
That would be ideal. But is that possible with the current setup? If not maybe keep the test_unit generators listed for completeness? Just my opinion though, need more +1/-1 in here.
-
sarah (at ultrasaurus)
why isn't testunit a gem like rspec? then it could be listed in my Gemfile and I could omit it if I don't want its generators to show up
-
phatmann
Still very annoying to see the test_unit generators. Rails3 is supposed to be more modular and agnostic. Test::Unit should play on the same footing as RSpec.
-
José Valim
Sarah got the issue. The problem is that the test unit compatibility is not a gem (and I don't think it will be). The only way to effectively remove test_unit is by replacing rails/all by specific requires, as in:
https://github.com/rails/rails/blob/master/railties/lib/rails/all.rb
This is what the --skip-activerecord option in app generator does and maybe --skip-testunit could do the same. Anyone willing to provide a patch?
This is a minor annoyance but not lets get crazy over here and say Rails 3 is neither modular nor agnostic because of this, shall we?