Mercurial > hg > soundsoftware-site
comparison 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 |
comparison
equal
deleted
inserted
replaced
451:a9f6345cb43d | 511:107d36338b70 |
---|---|
1 require File.dirname(__FILE__) + '/../test_helper' | 1 require File.expand_path('../../test_helper', __FILE__) |
2 | 2 |
3 class IssueMovesControllerTest < ActionController::TestCase | 3 class IssueMovesControllerTest < ActionController::TestCase |
4 fixtures :all | 4 fixtures :all |
5 | 5 |
6 def setup | 6 def setup |
56 | 56 |
57 should "allow adding a note when moving" do | 57 should "allow adding a note when moving" do |
58 post :create, :ids => [1, 2], :notes => 'Moving two issues' | 58 post :create, :ids => [1, 2], :notes => 'Moving two issues' |
59 | 59 |
60 assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook' | 60 assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook' |
61 assert_equal 'Moving two issues', Issue.find(1).journals.last.notes | 61 assert_equal 'Moving two issues', Issue.find(1).journals.sort_by(&:id).last.notes |
62 assert_equal 'Moving two issues', Issue.find(2).journals.last.notes | 62 assert_equal 'Moving two issues', Issue.find(2).journals.sort_by(&:id).last.notes |
63 | 63 |
64 end | 64 end |
65 | 65 |
66 end | 66 end |
67 | 67 |
110 assert_equal 3, issue.status_id, "Status is incorrect" | 110 assert_equal 3, issue.status_id, "Status is incorrect" |
111 assert_equal '2009-12-01', issue.start_date.to_s, "Start date is incorrect" | 111 assert_equal '2009-12-01', issue.start_date.to_s, "Start date is incorrect" |
112 assert_equal '2009-12-31', issue.due_date.to_s, "Due date is incorrect" | 112 assert_equal '2009-12-31', issue.due_date.to_s, "Due date is incorrect" |
113 end | 113 end |
114 end | 114 end |
115 | |
116 should "allow adding a note when copying" do | |
117 @request.session[:user_id] = 2 | |
118 assert_difference 'Issue.count', 1 do | |
119 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' | |
120 end | |
121 | |
122 issue = Issue.first(:order => 'id DESC') | |
123 assert_equal 1, issue.journals.size | |
124 journal = issue.journals.first | |
125 assert_equal 0, journal.details.size | |
126 assert_equal 'Copying one issue', journal.notes | |
127 end | |
115 end | 128 end |
116 | 129 |
117 def test_copy_to_another_project_should_follow_when_needed | 130 def test_copy_to_another_project_should_follow_when_needed |
118 @request.session[:user_id] = 2 | 131 @request.session[:user_id] = 2 |
119 post :create, :ids => [1], :new_project_id => 2, :copy_options => {:copy => '1'}, :follow => '1' | 132 post :create, :ids => [1], :new_project_id => 2, :copy_options => {:copy => '1'}, :follow => '1' |