##// END OF EJS Templates
adjust functional IssuesControllerTest (#1005)...
Toshi MARUYAMA -
r11657:dbc7369d9d83
parent child
Show More
@@ -2449,12 +2449,12 class IssuesControllerTest < ActionController::TestCase
2449 issue = Issue.find(3)
2449 issue = Issue.find(3)
2450 count = issue.attachments.count
2450 count = issue.attachments.count
2451 assert count > 0
2451 assert count > 0
2452
2453 assert_difference 'Issue.count' do
2452 assert_difference 'Issue.count' do
2454 assert_difference 'Attachment.count', count do
2453 assert_difference 'Attachment.count', count do
2455 assert_no_difference 'Journal.count' do
2454 assert_difference 'Journal.count', 2 do
2456 post :create, :project_id => 1, :copy_from => 3,
2455 post :create, :project_id => 1, :copy_from => 3,
2457 :issue => {:project_id => '1', :tracker_id => '3', :status_id => '1', :subject => 'Copy with attachments'},
2456 :issue => {:project_id => '1', :tracker_id => '3',
2457 :status_id => '1', :subject => 'Copy with attachments'},
2458 :copy_attachments => '1'
2458 :copy_attachments => '1'
2459 end
2459 end
2460 end
2460 end
@@ -2469,12 +2469,12 class IssuesControllerTest < ActionController::TestCase
2469 issue = Issue.find(3)
2469 issue = Issue.find(3)
2470 count = issue.attachments.count
2470 count = issue.attachments.count
2471 assert count > 0
2471 assert count > 0
2472
2473 assert_difference 'Issue.count' do
2472 assert_difference 'Issue.count' do
2474 assert_no_difference 'Attachment.count' do
2473 assert_no_difference 'Attachment.count' do
2475 assert_no_difference 'Journal.count' do
2474 assert_difference 'Journal.count', 2 do
2476 post :create, :project_id => 1, :copy_from => 3,
2475 post :create, :project_id => 1, :copy_from => 3,
2477 :issue => {:project_id => '1', :tracker_id => '3', :status_id => '1', :subject => 'Copy with attachments'}
2476 :issue => {:project_id => '1', :tracker_id => '3',
2477 :status_id => '1', :subject => 'Copy with attachments'}
2478 end
2478 end
2479 end
2479 end
2480 end
2480 end
@@ -2487,14 +2487,16 class IssuesControllerTest < ActionController::TestCase
2487 issue = Issue.find(3)
2487 issue = Issue.find(3)
2488 count = issue.attachments.count
2488 count = issue.attachments.count
2489 assert count > 0
2489 assert count > 0
2490
2491 assert_difference 'Issue.count' do
2490 assert_difference 'Issue.count' do
2492 assert_difference 'Attachment.count', count + 1 do
2491 assert_difference 'Attachment.count', count + 1 do
2493 assert_no_difference 'Journal.count' do
2492 assert_difference 'Journal.count', 2 do
2494 post :create, :project_id => 1, :copy_from => 3,
2493 post :create, :project_id => 1, :copy_from => 3,
2495 :issue => {:project_id => '1', :tracker_id => '3', :status_id => '1', :subject => 'Copy with attachments'},
2494 :issue => {:project_id => '1', :tracker_id => '3',
2495 :status_id => '1', :subject => 'Copy with attachments'},
2496 :copy_attachments => '1',
2496 :copy_attachments => '1',
2497 :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'test file'}}
2497 :attachments => {'1' =>
2498 {'file' => uploaded_test_file('testfile.txt', 'text/plain'),
2499 'description' => 'test file'}}
2498 end
2500 end
2499 end
2501 end
2500 end
2502 end
@@ -2519,11 +2521,11 class IssuesControllerTest < ActionController::TestCase
2519 @request.session[:user_id] = 2
2521 @request.session[:user_id] = 2
2520 issue = Issue.generate_with_descendants!
2522 issue = Issue.generate_with_descendants!
2521 count = issue.descendants.count
2523 count = issue.descendants.count
2522
2524 assert_difference 'Issue.count', count + 1 do
2523 assert_difference 'Issue.count', count+1 do
2525 assert_difference 'Journal.count', (count + 1) * 2 do
2524 assert_no_difference 'Journal.count' do
2525 post :create, :project_id => 1, :copy_from => issue.id,
2526 post :create, :project_id => 1, :copy_from => issue.id,
2526 :issue => {:project_id => '1', :tracker_id => '3', :status_id => '1', :subject => 'Copy with subtasks'},
2527 :issue => {:project_id => '1', :tracker_id => '3',
2528 :status_id => '1', :subject => 'Copy with subtasks'},
2527 :copy_subtasks => '1'
2529 :copy_subtasks => '1'
2528 end
2530 end
2529 end
2531 end
@@ -2535,11 +2537,11 class IssuesControllerTest < ActionController::TestCase
2535 def test_create_as_copy_without_copy_subtasks_option_should_not_copy_subtasks
2537 def test_create_as_copy_without_copy_subtasks_option_should_not_copy_subtasks
2536 @request.session[:user_id] = 2
2538 @request.session[:user_id] = 2
2537 issue = Issue.generate_with_descendants!
2539 issue = Issue.generate_with_descendants!
2538
2539 assert_difference 'Issue.count', 1 do
2540 assert_difference 'Issue.count', 1 do
2540 assert_no_difference 'Journal.count' do
2541 assert_difference 'Journal.count', 2 do
2541 post :create, :project_id => 1, :copy_from => 3,
2542 post :create, :project_id => 1, :copy_from => 3,
2542 :issue => {:project_id => '1', :tracker_id => '3', :status_id => '1', :subject => 'Copy with subtasks'}
2543 :issue => {:project_id => '1', :tracker_id => '3',
2544 :status_id => '1', :subject => 'Copy with subtasks'}
2543 end
2545 end
2544 end
2546 end
2545 copy = Issue.where(:parent_id => nil).first(:order => 'id DESC')
2547 copy = Issue.where(:parent_id => nil).first(:order => 'id DESC')
@@ -3727,11 +3729,10 class IssuesControllerTest < ActionController::TestCase
3727 :status_id => '3', :start_date => '2009-12-01', :due_date => '2009-12-31'
3729 :status_id => '3', :start_date => '2009-12-01', :due_date => '2009-12-31'
3728 }
3730 }
3729 end
3731 end
3730
3731 issue = Issue.first(:order => 'id DESC')
3732 issue = Issue.first(:order => 'id DESC')
3732 assert_equal 1, issue.journals.size
3733 assert_equal 1, issue.journals.size
3733 journal = issue.journals.first
3734 journal = issue.journals.first
3734 assert_equal 0, journal.details.size
3735 assert_equal 1, journal.details.size
3735 assert_equal 'Copying one issue', journal.notes
3736 assert_equal 'Copying one issue', journal.notes
3736 end
3737 end
3737
3738
General Comments 0
You need to be logged in to leave comments. Login now