This project is archived and is in readonly mode.

#3534 ✓resolved
Matthias Hennemeyer

Failing test hidden by exclamation point in test method name

Reported by Matthias Hennemeyer | December 2nd, 2009 @ 10:59 AM

In activerecord/test/cases/associations/has_one_associations_test.rb:331
there is a test method with an exclamation point in the middle of the method name:

def test_create!_respects_hash_condition
    account = companies(:first_firm).create_account_limit_500_with_hash_conditions!
    assert       !account.new_record?
    assert_equal 500, account.credit_limit

This won't be catched if run with classic TestUnit (*).
Changing the test name to test_create_bang_respects_hash_condition shows that the test is actually failing:

1) Error:
NoMethodError: undefined method create_account_limit_500_with_hash_conditions!' for #<Firm:0x000001024ab948>

I think that there are no create_something! bang methods supposed to be generated. (?!?)
(-> ActiveRecord::Associations Rdoc : activerecord/lib/active_record/associations.rb:154 ff)

The patch removes the test.

(*) Following test suite will pass (with Ruby 1.9.1p243):

require "test/unit"

class MyTest < Test::Unit::TestCase
  def test!_me
    has no effect because this will never be evaluated!

  def test_something

Comments and changes to this ticket

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=""></a>