I am seeing weird issues when trying to create integration tests. Here
is a very simple example of something that is failing. The
assert_redirected_to, and other methods, fail with this or similar
exceptions.
I have tried requiring both ‘application’ and ‘listings_controller’, but
neither solves this problem, although the exception changes.
Anybody know what’s going on here?
Thanks.
require “#{File.dirname(FILE)}/…/test_helper”
class FooTest < ActionController::IntegrationTest
def test_redirect
get “/”
assert_redirected_to “/”
end
end
with this exception:
NameError: uninitialized constant ApplicationController
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.1/lib/active_support/dependencies.rb:266:in
load_missing_constant' /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.1/lib/active_support/dependencies.rb:453:in
const_missing’
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.1/lib/active_support/dependencies.rb:465:in
const_missing' /Users/.../trunk/rails/app/controllers/listings_controller.rb:3 /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.1/lib/active_support/dependencies.rb:203:in
load_without_new_constant_marking’
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.1/lib/active_support/dependencies.rb:203:in
load_file' /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.1/lib/active_support/dependencies.rb:342:in
new_constants_in’
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.1/lib/active_support/dependencies.rb:202:in
load_file' /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.1/lib/active_support/dependencies.rb:94:in
require_or_load’
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.1/lib/active_support/dependencies.rb:248:in
load_missing_constant' /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.1/lib/active_support/dependencies.rb:453:in
const_missing’
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.1/lib/active_support/dependencies.rb:465:in
const_missing' /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.1/lib/active_support/inflector.rb:257:in
constantize’
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.1/lib/active_support/core_ext/string/inflections.rb:148:in
constantize' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.1/lib/action_controller/routing.rb:1423:in
recognize’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.1/lib/action_controller/assertions/routing_assertions.rb:138:in
recognized_request_for' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.1/lib/action_controller/assertions/response_assertions.rb:70:in
assert_redirected_to’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.1/lib/action_controller/assertions/response_assertions.rb:62:in
each' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.1/lib/action_controller/assertions/response_assertions.rb:62:in
assert_redirected_to’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.1/lib/action_controller/assertions.rb:54:in
clean_backtrace' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.1/lib/action_controller/assertions/response_assertions.rb:54:in
assert_redirected_to’
test/integration/foo_test.rb:6:in test_redirect' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.1/lib/action_controller/integration.rb:532:in
run’