This project is archived and is in readonly mode.

#5692 ✓wontfix
eightbitraptor

generated tests should flunk when unimplemented

Reported by eightbitraptor | September 23rd, 2010 @ 05:12 PM

when using the generators, eg

rails generate controller my_controller

test/unit tests are generated. These tests traditionally have contained something along the lines of

test "the truth" do
  assert true
end

I believe the correct situation should be for the tests by default to flunk. The emphasis should be on the developer to make them pass rather than starting with a complete suite of passing (but useless) tests.

I have attached a patch for consideration.

Matt

Comments and changes to this ticket

  • eightbitraptor
  • Jeremy Kemper

    Jeremy Kemper September 23rd, 2010 @ 05:43 PM

    • State changed from “new” to “wontfix”
    • Importance changed from “” to “Low”

    Thanks Matt! We've gone back one forth on fail-by-default and we keep coming back to keeping the new-user experience clean and understandable. A failing boolean is confusingly irrelevant.

  • eightbitraptor

    eightbitraptor September 23rd, 2010 @ 05:58 PM

    Thanks for the feedback. I guess that makes sense however I would argue that a misleading pass would be more harmful than a more verbose rake output. It could give a false sense of confidence that generated code is already tested for example.

    Anyway. I'm assuming this has already been argued to death so i'll let this one die.

    Matt.

  • Andrew White

    Andrew White October 18th, 2010 @ 12:12 PM

    Why not use pending as a middle way?

    require 'test_helper'
    
    class PagesControllerTest < ActionController::TestCase
      test "pages controller" do
        pending "Replace this with your real tests"
      end
    end
    

    That way you don't get a backtrace and error message if you're lazy, just a single line acting as a reminder.

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>

Attachments

Tags

Pages