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,... 1) 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 --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2007-Dec-18 11:30 UTC
Re: rails 2.0 functional tests fail, Testscenario changed?
On 18 Dec 2007, at 10:25, Rafael wrote:> > 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? >Rails tries to figure out the name of the controller (the aim is to factor out the pretty much identical setup method in all functional tests). You can override what it thinks it should test like so class FooTest < ActionController::TestCase tests MyControllerClass end That said, i''ve just tried it out with namespaced controllers and it works without modifications. What''s in admin/post_controller ? 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Rick DeNatale
2007-Dec-18 21:38 UTC
Re: rails 2.0 functional tests fail, Testscenario changed?
On 12/18/07, Rafael <beyoumedia-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> My File Structure > > app/posts_controller.rb > app/admin/posts_controller.rbIs it really this as opposed to: app/controllers/posts_controller.rb app/controllers/admin/posts_controller.rb> test/posts_controller_test.rb > test/admin/posts_controller_test.rbThese also look suspicious, since controller tests normally go under test/functional. I''ve become a RSpec guy, so I''m not sure where a namespaced controller test is supposed to go in the test hierarchy. -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/ --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---