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.

rescue in run': undefined method `name' for #<ProductTest:> (NoMethodError)

#5406
$ rails -v
Rails 2.3.8

$ ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-linux]

$ rails test
      create  
      create  app/controllers
      create  app/helpers
      create  app/models
      create  app/views/layouts
      create  config/environments
      create  config/initializers
      create  config/locales
      create  db
      create  doc
      create  lib
      create  lib/tasks
      create  log
      create  public/images
      create  public/javascripts
      create  public/stylesheets
      create  script/performance
      create  test/fixtures
      create  test/functional
      create  test/integration
      create  test/performance
      create  test/unit
      create  vendor
      create  vendor/plugins
      create  tmp/sessions
      create  tmp/sockets
      create  tmp/cache
      create  tmp/pids
      create  Rakefile
      create  README
      create  app/controllers/application_controller.rb
      create  app/helpers/application_helper.rb
      create  config/database.yml
      create  config/routes.rb
      create  config/locales/en.yml
      create  db/seeds.rb
      create  config/initializers/backtrace_silencers.rb
      create  config/initializers/inflections.rb
      create  config/initializers/mime_types.rb
      create  config/initializers/new_rails_defaults.rb
      create  config/initializers/session_store.rb
      create  config/initializers/cookie_verification_secret.rb
      create  config/environment.rb
      create  config/boot.rb
      create  config/environments/production.rb
      create  config/environments/development.rb
      create  config/environments/test.rb
      create  script/about
      create  script/console
      create  script/dbconsole
      create  script/destroy
      create  script/generate
      create  script/runner
      create  script/server
      create  script/plugin
      create  script/performance/benchmarker
      create  script/performance/profiler
      create  test/test_helper.rb
      create  test/performance/browsing_test.rb
      create  public/404.html
      create  public/422.html
      create  public/500.html
      create  public/index.html
      create  public/favicon.ico
      create  public/robots.txt
      create  public/images/rails.png
      create  public/javascripts/prototype.js
      create  public/javascripts/effects.js
      create  public/javascripts/dragdrop.js
      create  public/javascripts/controls.js
      create  public/javascripts/application.js
      create  doc/README_FOR_APP
      create  log/server.log
      create  log/production.log
      create  log/development.log
      create  log/test.log

$ cd test

$ ruby script/generate scaffold product title:string
      exists  app/models/
      exists  app/controllers/
      exists  app/helpers/
      create  app/views/products
      exists  app/views/layouts/
      exists  test/functional/
      exists  test/unit/
      create  test/unit/helpers/
      exists  public/stylesheets/
      create  app/views/products/index.html.erb
      create  app/views/products/show.html.erb
      create  app/views/products/new.html.erb
      create  app/views/products/edit.html.erb
      create  app/views/layouts/products.html.erb
      create  public/stylesheets/scaffold.css
      create  app/controllers/products_controller.rb
      create  test/functional/products_controller_test.rb
      create  app/helpers/products_helper.rb
      create  test/unit/helpers/products_helper_test.rb
       route  map.resources :products
  dependency  model
      exists    app/models/
      exists    test/unit/
      exists    test/fixtures/
      create    app/models/product.rb
      create    test/unit/product_test.rb
      create    test/fixtures/products.yml
      create    db/migrate
      create    db/migrate/20100818234417_create_products.rb

$ ruby -Itest test/unit/product_test.rb
Loaded suite test/unit/product_test
Started
/home/rubys/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-2.3.8/lib/active_support/testing/setup_and_teardown.rb:26:in `rescue in run': undefined method `name' for #<ProductTest:0x000000033e1d88> (NoMethodError)
    from /home/rubys/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-2.3.8/lib/active_support/testing/setup_and_teardown.rb:33:in `run'
    from /home/rubys/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/minitest/unit.rb:641:in `block (2 levels) in run_test_suites'
    from /home/rubys/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/minitest/unit.rb:635:in `each'
    from /home/rubys/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/minitest/unit.rb:635:in `block in run_test_suites'
    from /home/rubys/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/minitest/unit.rb:634:in `each'
    from /home/rubys/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/minitest/unit.rb:634:in `run_test_suites'
    from /home/rubys/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/minitest/unit.rb:594:in `run'
    from /home/rubys/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/minitest/unit.rb:492:in `block in autorun'

Note: problem goes away with a rake db:test:prepare; but that's not the point, the point is that application programmer errors aren't caught properly with Rails 2.3.x on 1.9.2.

Reported by Sam Ruby · August 19th, 2010 @ 01:08 AM

State: resolved
Milestone: 2.3.10
Assigned to: nobody
Importance: Medium

Activity

  1. Jeremy Kemper
    Jeremy Kemper
    • Milestone changed from 2.3.9 to 2.3.10

    August 30th, 2010 @ 02:28 AM

  2. Repository
  3. Repository
  4. Repository
  5. Sam Ruby
    Sam Ruby
    • State changed from resolved to verified

    With this fix, I no longer see the problem. Thanks!

    October 6th, 2010 @ 07:44 PM

  6. Rohit Arondekar
    Rohit Arondekar
    • State changed from verified to resolved

    Sam, I think you meant resolved instead of verified? Verified state is for patches that have been confirmed and ready to commit.

    October 7th, 2010 @ 02:53 AM