On Mar 30, 7:58 pm, Cameron Carroll
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> Hilo. I''m trying to build an app with TDD, but my first functional
test
> is a mess. The example from the book fails, and I haven''t found
any
> information on this issue. When I run my test, it throws:
> C:\Users\NomNomNom\Documents\NetBeansProjects\Embark\test\functional\admin\
author_controller_test.rb:4:
> superclass mismatch for class AuthorControllerTest (TypeError)
>
> Here is my test:
> [code]require File.dirname(__FILE__) +
''/../../test_helper''
> require ''admin/author_controller''
> class Admin::AuthorControllerTest; def rescue_action(e) raise e end; end
> class Admin::AuthorControllerTest < Test::Unit::TestCase
It''s these two line above: you''ve declared
Admin::AuthorControllerTest
as deriving from Object , and the line below you say it derives from
Test::Unit::TestCase. The standard boiler plate should actually read
class Admin::AuthorController; def rescue_action(e) raise e end; end
class Admin::AuthorControllerTest < Test::Unit::TestCase
As of rails 2.1 you don''t that - you''re test file can just be
require File.dirname(__FILE__) + ''/../../test_helper''
class Admin::AuthorControllerTest < ActionController::TestCase
def test_new
..
end
end
subclassing from ActionController::TestCase means you don''t need the
setup method or the funky error re-raising stuff.
Fred
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---