From 4793c2b770fcb018303b7ab226b75cc218364327 Mon Sep 17 00:00:00 2001 From: jessib Date: Tue, 4 Dec 2012 15:44:32 -0800 Subject: A test of ordering of tickets. --- help/test/functional/tickets_controller_test.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'help/test') diff --git a/help/test/functional/tickets_controller_test.rb b/help/test/functional/tickets_controller_test.rb index c88e7ae..611cf86 100644 --- a/help/test/functional/tickets_controller_test.rb +++ b/help/test/functional/tickets_controller_test.rb @@ -194,6 +194,18 @@ class TicketsControllerTest < ActionController::TestCase assigns(:ticket).destroy + # test ordering + + get :index, {:admin_status => "mine", :open_status => "open", :sort_order => 'created_at_desc'} + first_tick = assigns(:all_tickets).all.first + last_tick = assigns(:all_tickets).all.last + # and now reverse order: + get :index, {:admin_status => "mine", :open_status => "open", :sort_order => 'created_at_asc'} + assert_equal first_tick, assigns(:all_tickets).all.last + assert_equal last_tick, assigns(:all_tickets).all.first + assert_not_equal first_tick, assigns(:all_tickets).all.first + assert_not_equal last_tick, assigns(:all_tickets).all.last + end end -- cgit v1.2.3