I''m having a bit of trouble getting functional tests running on Rails
0.11.1. On a freshly generated controller, with the default test
class, and when running a pretty simple test (get :new), I get the
following failure (file paths shortened for clarity):
1) Error:
test_new(TaskControllerTest):
NoMethodError: undefined method `controller_path'' for
TaskController:Class
actionpack-1.7.0/lib/action_controller/test_process.rb:257:in
`process''
(eval):3:in `get''
efforttrack-dev/test/functional/task_controller_test.rb:20:in
`test_new''
If I remove the reopened TaskController at the top of the test, the
stack makes it pretty clear that the framework can''t find my
controller:
1) Error:
test_new(TaskControllerTest):
NameError: uninitialized constant Controllers::TaskController
activesupport-1.0.3/lib/active_support/dependencies.rb:69:in
`const_missing''
activesupport-1.0.3/lib/active_support/dependencies.rb:175:in
`const_get''
activesupport-1.0.3/lib/active_support/dependencies.rb:175:in
`const_missing''
efforttrack-dev/test/functional/task_controller_test.rb:9:in
`setup_without_fixtures''
activerecord-1.9.1/lib/active_record/fixtures.rb:450:in `setup''
activerecord-1.9.1/lib/active_record/fixtures.rb:448:in `setup''
The code for this particular test is:
require File.dirname(__FILE__) + ''/../test_helper''
require ''task_controller''
# Re-raise errors caught by the controller.
#class TaskController; def rescue_action(e) raise e end; end
class TaskControllerTest < Test::Unit::TestCase
def setup
@controller = TaskController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
end
def test_truth
assert true
end
def test_new
get :new
assert_success
end
end
Unit tests run fine. Just having trouble with even the simplest
functional tests. The application also runs fine, seemingly finding
the controllers (although it doesn''t do much, as I''m
attempting to go
test-driven, and thus I''m not driving very fast right now).
--
David Naseby
http ://homepages.ihug.com.au/~naseby/