This project is archived and is in readonly mode.

#5393 ✓stale
David Chelimsky

NoMethodError on formats= when using ActionController::TestCase to test a direct subclass of ActionController::Metal

Reported by David Chelimsky | August 17th, 2010 @ 01:15 PM | in 3.1

When using ActionController::TestCase to test a direct subclass of ActionController::Metal, the test case raises a NoMethodError on formats=. To see this in action:

  1. Type the following in a shell:
rails new example
cd example
rake db:migrate
  1. Add test/functional/widgets_controller_test.rb with the following code:
require 'test_helper'

class WidgetsControllerTest < ActionController::TestCase
  test "GET index" do
    get :index
  1. Add app/controllers/widgets_controller.rb with the following code:
class WidgetsController < ActionController::Metal
  def index
  1. Run the test:
rake test:functionals
  1) Error:
NoMethodError: undefined method `formats=' for #<WidgetsController:0x101e601e8>
    /test/functional/widgets_controller_test.rb:5:in `test_GET_index'

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>

Referenced by