Hi everybody
may be somebody has a hint for that issue, that costs me now hours and
hours and finally it will be a tiny thing, I guess.
Anyway thank you very much in advance for helping here.
Our Approach:
Admin and Backend is seperated through a namespace filestructure
“admin”. Actually everything works fine,
except the Functional Tests.
What should a admin/posts_controller_test.rb look like, when I want to
have an admin/posts_controller.rb?
My File Structure
app/posts_controller.rb
app/admin/posts_controller.rb
test/posts_controller_test.rb
test/admin/posts_controller_test.rb
when I setup my admin test I get always these errors,…
- Error:
test_should_update_post(Admin::PostsControllerTest):
NameError: uninitialized constant PostsController
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/
active_support/dependencies.rb:266:in load_missing_constant' /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/ active_support/dependencies.rb:453:in
const_missing’
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/
active_support/dependencies.rb:465:in const_missing' /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/ active_support/inflector.rb:257:in
constantize’
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/
active_support/core_ext/string/inflections.rb:148:in constantize' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/routing.rb:1426:in
recognize’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/
action_controller/assertions/routing_assertions.rb:138:in
recognized_request_for' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/assertions/response_assertions.rb:70:in
assert_redirected_to’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/
action_controller/assertions/response_assertions.rb:62:in each' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/assertions/response_assertions.rb:62:in
assert_redirected_to’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/
action_controller/assertions.rb:54:in clean_backtrace' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/assertions/response_assertions.rb:54:in
assert_redirected_to’
./test/functional/admin/posts_controller_test.rb:45:in
test_should_update_post' /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/ active_support/testing/default.rb:7:in
run’
1 tests, 0 assertions, 0 failures, 1 error
my testfile looks like that:
class Admin::PostsControllerTest < ActionController::TestCase
Replace this with your real tests.
def test_should_update_posts
put :update, :id => posts(:one).id, :posts => { }
assert_redirected_to posts_path(assigns(:posts))
end
end
I think it is a namespace issue only,
but I couldn’t figure it out how and why it (doesn’t)works, so I
wondered if there changed some things in Rails 2.0?
Any help is really really appreciated
best regards
Rafael