itsaboutprogress
2007-May-16 21:59 UTC
Having issues with integration test - responses are always 500
I have a test class for integration testing some operations in my application. Im simply trying to test whether a user with role of ''user'' can access a specific page in the application which is mapped in the database. I can successfully do this if I manually login to the application locally and step thru the process. However I get what seems to be bizarre errors when running the integration test. The errors for every method in this test class return either a 500 error or an error about expecting index but rendering with diagnostics.rhtml (?). I have verified that the test database is in use and the fixtures are loaded. I have also verified that the server is running in test mode. Below is the integration test method and the stack trace for one test case for simplicity. Any help would be appreciated! thanks Ryan ===============Source =============== fixtures :users def test_should_allow_user_role_on_user_only_level user = users(:john) # need to rename controller. LoginController::login is confusing. post "/login/login", :username => user.username, :password => "testpassword" session[:user] = user assert_not_nil session[:user] # Try to access a non-protected resource get ''/users/index'' assert_template "index" end ==========================Stacktrace: ========================== 1) Failure: test_should_allow_user_role_on_user_only_level(UsersTest) [c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/assertions/response_assertions.rb:112:in `as sert_template'' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/assertions/response_assertions.rb:109:in `as sert_template'' users_test.rb:14:in `test_should_allow_user_role_on_user_only_level'' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/integration.rb:453:in `run'']: expecting <"index"> but rendering with <"diagnostics.rhtml"> 1 tests, 2 assertions, 1 failures, 0 errors --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---