Commits

Akiko Takano committed b6656f3

Update test code for reordering. (IssueID: #962)

  • Participants
  • Parent commits 9358753
  • Branches feature_962

Comments (0)

Files changed (3)

 Rails.application.routes.draw do 
   match 'projects/:project_id/issue_templates/:action', :to => 'issue_templates'
   match 'projects/:project_id/issue_templates/:action/:id', :to => 'issue_templates#edit'
+  match 'projects/:project_id/issue_templates/move/:id', :to => 'issue_templates#move_to'
   match 'projects/:project_id/issue_templates_settings/:action', :to => 'issue_templates_settings'
   match 'issue_templates/preview', :to => 'issue_templates#preview', :via => [:get, :post]
   match 'projects/:project_id/issue_templates_settings/preview', :to => 'issue_templates_settings#preview', :via => [:get, :post]

test/fixtures/issue_templates.yml

   note: note1
   
   enabled: true
-
+  
+  position: 1
 
 two:
   id: 2
   note: note2
   
   enabled: false
+
+  position: 1
   
 three:
   id: 3
   note: note3
   
   enabled: true
+
+  position: 1
   
 four:
   id: 4
   
   enabled: true   
 
+  position: 2
+
 five:
   id: 5
 
 
   note: note5
   
-  enabled: false
+  enabled: false
+
+  position: 3
+  

test/functional/issue_templates_controller_test.rb

         assert_equal(1, issue_template.project.id)
         assert_equal(1, issue_template.author.id)     
       end
+      
+      should "move to bottom and top" do
+        issue_template = IssueTemplate.find(1)
+        get :move, :project_id => 1, :id => 1, :to => :to_bottom
+        assert_equal 3, issue_template.reload.position
+        get :move, :project_id => 1, :id => 1, :to => :to_top
+        assert_equal 1, issue_template.reload.position        
+      end
    end
   end