diff test/functional/issue_moves_controller_test.rb @ 511:107d36338b70 live

Merge from branch "cannam"
author Chris Cannam
date Thu, 14 Jul 2011 10:43:07 +0100
parents cbce1fd3b1b7
children cbb26bc654de
line wrap: on
line diff
--- a/test/functional/issue_moves_controller_test.rb	Thu Jun 09 16:51:06 2011 +0100
+++ b/test/functional/issue_moves_controller_test.rb	Thu Jul 14 10:43:07 2011 +0100
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + '/../test_helper'
+require File.expand_path('../../test_helper', __FILE__)
 
 class IssueMovesControllerTest < ActionController::TestCase
   fixtures :all
@@ -58,8 +58,8 @@
       post :create, :ids => [1, 2], :notes => 'Moving two issues'
 
       assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook'
-      assert_equal 'Moving two issues', Issue.find(1).journals.last.notes
-      assert_equal 'Moving two issues', Issue.find(2).journals.last.notes
+      assert_equal 'Moving two issues', Issue.find(1).journals.sort_by(&:id).last.notes
+      assert_equal 'Moving two issues', Issue.find(2).journals.sort_by(&:id).last.notes
 
     end
     
@@ -112,6 +112,19 @@
         assert_equal '2009-12-31', issue.due_date.to_s, "Due date is incorrect"
       end
     end
+
+    should "allow adding a note when copying" do
+      @request.session[:user_id] = 2
+      assert_difference 'Issue.count', 1 do
+        post :create, :ids => [1], :copy_options => {:copy => '1'}, :notes => 'Copying one issue', :new_tracker_id => '', :assigned_to_id => 4, :status_id => 3, :start_date => '2009-12-01', :due_date => '2009-12-31'
+      end
+      
+      issue = Issue.first(:order => 'id DESC')
+      assert_equal 1, issue.journals.size
+      journal = issue.journals.first
+      assert_equal 0, journal.details.size
+      assert_equal 'Copying one issue', journal.notes
+    end
   end
   
   def test_copy_to_another_project_should_follow_when_needed