This project is archived and is in readonly mode.

#5852 ✓stale
sarah (at ultrasaurus)

please don't hide test framework generators

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

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...

Comments and changes to this ticket

  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 04:28 PM

    • 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.

  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 04:28 PM

    • State changed from “open” to “stale”
  • sarah (at ultrasaurus)

    sarah (at ultrasaurus) February 6th, 2011 @ 12:58 AM

    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.

  • sarah (at ultrasaurus)

    sarah (at ultrasaurus) February 6th, 2011 @ 01:03 AM

    • 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.

  • rails

    rails May 7th, 2011 @ 01:00 AM

    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.

  • rails

    rails May 7th, 2011 @ 01:00 AM

    • State changed from “open” to “stale”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Pages