Hello, a very strange thing is happening : the test below pass but it should fail I had a syntax error which produced an exception in the browser and http 500 in the script/console (using app.get ''/'') But with rake test:functionals it passes - How is it possible ? Of course this file is really executed by the test suite, I can see it in the screen output of rake Which mistery is this ? Thanks require File.dirname(__FILE__) + ''/../test_helper'' require ''alerts_controller'' # Re-raise errors caught by the controller. class AlertsController; def rescue_action(e) raise e end; end class AlertsControllerTest < Test::Unit::TestCase fixtures :clients def setup @controller = AlertsController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new end def test_get_index get :index assert_response :success end end -- Posted via http://www.ruby-forum.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 -~----------~----~----~----~------~----~------~--~---
On 10/12/06, nuno <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Hello, a very strange thing is happening : the test below pass but it > should fail > I had a syntax error which produced an exception in the browser and http > 500 in the script/console (using app.get ''/'') > > But with rake test:functionals it passes - How is it possible ? Of > course this file is really executed by the test suite, I can see it in > the screen output of rake > > Which mistery is this ? > > Thanks > > require File.dirname(__FILE__) + ''/../test_helper'' > require ''alerts_controller'' > > # Re-raise errors caught by the controller. > class AlertsController; def rescue_action(e) raise e end; end > > class AlertsControllerTest < Test::Unit::TestCase > fixtures :clients > > def setup > @controller = AlertsController.new > @request = ActionController::TestRequest.new > @response = ActionController::TestResponse.new > end > > def test_get_index > get :index > assert_response :success > end > > end > > --A couple of suggestions. * Does the test fail if you run it alone from the command line (outside of rake) $ cd my_app $ ruby test/functional/alerts_controller_test * Output the http response in the body of the test and see what is actually getting returned. def test_get_index get :index puts @response.body # (maybe this is response.body?) assert_response :success end * Are you rendering any partials within the index template? There is (or at least was) a nasty bug in the compiling of partials which can lead to them working only in a certain order. Chris --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Also, be VERY aware that the integration testing ( app.get''/'' ) goes through the whole routing system, whereas the functional test get :index doesn''t. It could be a routing problem. get :index just instantiates a controller object and invokes the get action, no routing or, url mapping involved. * What does your routes.rb look like ? * if you use app.get ''/alerts/index'' does it work ? A. -- Posted via http://www.ruby-forum.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 -~----------~----~----~----~------~----~------~--~---