]> source.dussan.org Git - redmine.git/commitdiff
Trying to fix random failures with postgresql due to different ids order in urls.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 9 Jan 2011 21:01:40 +0000 (21:01 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 9 Jan 2011 21:01:40 +0000 (21:01 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4673 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/functional/context_menus_controller_test.rb

index 7f160881cd79a05489c0777badd76014d24c2605..67e919a9c2d6605411c753a9d4a208f1f8c67267 100644 (file)
@@ -56,26 +56,30 @@ class ContextMenusControllerTest < ActionController::TestCase
     get :issues, :ids => [1, 2]
     assert_response :success
     assert_template 'context_menu'
+    assert_not_nil assigns(:issues)
+    assert_equal [1, 2], assigns(:issues).map(&:id).sort
+                              
+    ids = assigns(:issues).map(&:id).map {|i| "ids%5B%5D=#{i}"}.join('&amp;')
     assert_tag :tag => 'a', :content => 'Edit',
-                            :attributes => { :href => '/issues/bulk_edit?ids%5B%5D=1&amp;ids%5B%5D=2',
+                            :attributes => { :href => "/issues/bulk_edit?#{ids}",
                                              :class => 'icon-edit' }
     assert_tag :tag => 'a', :content => 'Closed',
-                            :attributes => { :href => '/issues/bulk_edit?ids%5B%5D=1&amp;ids%5B%5D=2&amp;issue%5Bstatus_id%5D=5',
+                            :attributes => { :href => "/issues/bulk_edit?#{ids}&amp;issue%5Bstatus_id%5D=5",
                                              :class => '' }
     assert_tag :tag => 'a', :content => 'Immediate',
-                            :attributes => { :href => '/issues/bulk_edit?ids%5B%5D=1&amp;ids%5B%5D=2&amp;issue%5Bpriority_id%5D=8',
+                            :attributes => { :href => "/issues/bulk_edit?#{ids}&amp;issue%5Bpriority_id%5D=8",
                                              :class => '' }
     assert_tag :tag => 'a', :content => 'Dave Lopper',
-                            :attributes => { :href => '/issues/bulk_edit?ids%5B%5D=1&amp;ids%5B%5D=2&amp;issue%5Bassigned_to_id%5D=3',
+                            :attributes => { :href => "/issues/bulk_edit?#{ids}&amp;issue%5Bassigned_to_id%5D=3",
                                              :class => '' }
     assert_tag :tag => 'a', :content => 'Copy',
-                            :attributes => { :href => '/issues/move/new?copy_options%5Bcopy%5D=t&amp;ids%5B%5D=1&amp;ids%5B%5D=2',
+                            :attributes => { :href => "/issues/move/new?copy_options%5Bcopy%5D=t&amp;#{ids}",
                                              :class => 'icon-copy' }
     assert_tag :tag => 'a', :content => 'Move',
-                            :attributes => { :href => '/issues/move/new?ids%5B%5D=1&amp;ids%5B%5D=2',
+                            :attributes => { :href => "/issues/move/new?#{ids}",
                                              :class => 'icon-move' }
     assert_tag :tag => 'a', :content => 'Delete',
-                            :attributes => { :href => '/issues/destroy?ids%5B%5D=1&amp;ids%5B%5D=2',
+                            :attributes => { :href => "/issues/destroy?#{ids}",
                                              :class => 'icon-del' }
   end
 
@@ -84,7 +88,10 @@ class ContextMenusControllerTest < ActionController::TestCase
     get :issues, :ids => [1, 2, 6]
     assert_response :success
     assert_template 'context_menu'
-    ids = "ids%5B%5D=1&amp;ids%5B%5D=2&amp;ids%5B%5D=6"
+    assert_not_nil assigns(:issues)
+    assert_equal [1, 2, 6], assigns(:issues).map(&:id).sort
+    
+    ids = assigns(:issues).map(&:id).map {|i| "ids%5B%5D=#{i}"}.join('&amp;')
     assert_tag :tag => 'a', :content => 'Edit',
                             :attributes => { :href => "/issues/bulk_edit?#{ids}",
                                              :class => 'icon-edit' }