Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

please don't hide test framework generators

#5852

In order to do test-driven development with rspec, I like to use the rspec:model, rspec:controller, etc. generators. These don't show up in the docs and I'd like to see them there for when I'm teaching newbies.

Steps:
$ rails new app

then edit gem file to include
gem 'rspec-rails', '>= 2.0.0'

$ bundle $ rails generate rspec:install $ rails generate

in the list of generators I see:
Rspec:
rspec:install

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

I don't quite understand why rspec generators are hidden and testunit generators are not. I can see where this is happening, and someone seems to have taken extra care to hide them, which doesn't make sense to me.

In railties (3.0.1) lib/rails/generators.rb, the self.hidden_namespaces method appears to specifically exclude the generators for the test framework that is being used. (Before I do rails rspec:install, the testunit generators are hidden.)

seems to be related to: https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets...

Reported by sarah (at ultrasaurus) · October 21st, 2010 @ 04:26 PM

State: stale
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. Santiago Pastorino
    Santiago Pastorino
    • State changed from new to open

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

    February 2nd, 2011 @ 04:28 PM

  2. Santiago Pastorino
    Santiago Pastorino
    • State changed from open to stale

    February 2nd, 2011 @ 04:28 PM

  3. sarah (at ultrasaurus)
    sarah (at ultrasaurus)

    this is still a problem in Rails 3.0.3:

    $ rails -v Rails 3.0.3

    $ rails generate 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

    Rspec:
    rspec:install

    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

    $ rails generate rspec:integration messages

      create  spec/requests/messages_spec.rb
    

    I can use the rspec generators, but I can't see them in the help.

    February 6th, 2011 @ 12:58 AM

  4. sarah (at ultrasaurus)
    sarah (at ultrasaurus)
    • State changed from stale to open

    [state:open] The current behavior is very confusing for people new to Rails who are using rspec. It seems like there was a real effort in Rails 3 to treat all test frameworks as first class citizens, but this is a step backwards. It seems like someone did this on purpose, but I don't understand why.

    February 6th, 2011 @ 01:03 AM

  5. rails
    rails

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

    May 7th, 2011 @ 01:00 AM

  6. rails
    rails
    • State changed from open to stale

    May 7th, 2011 @ 01:00 AM