summaryrefslogtreecommitdiff
path: root/help/test
diff options
context:
space:
mode:
authorjessib <jessib@leap.se>2012-12-04 15:44:32 -0800
committerjessib <jessib@leap.se>2012-12-04 15:44:32 -0800
commit4793c2b770fcb018303b7ab226b75cc218364327 (patch)
tree33648210e974b989409ef0a34e26a18673f57299 /help/test
parenta38224d71ba0591395943177faa7bbaeb4851595 (diff)
A test of ordering of tickets.
Diffstat (limited to 'help/test')
-rw-r--r--help/test/functional/tickets_controller_test.rb12
1 files changed, 12 insertions, 0 deletions
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