1437 |
1437 |
assert_equal 59, File.size(attachment.diskfile)
|
1438 |
1438 |
end
|
1439 |
1439 |
|
|
1440 |
def test_post_create_with_login_name
|
|
1441 |
@request.session[:user_id] = 2
|
|
1442 |
user = User.find(4)
|
|
1443 |
|
|
1444 |
assert_difference 'Issue.count' do
|
|
1445 |
post :create, :project_id => 1,
|
|
1446 |
:issue => {:tracker_id => 3,
|
|
1447 |
:status_id => 2,
|
|
1448 |
:subject => 'This is the test_new_with_login issue',
|
|
1449 |
:description => 'This is the description',
|
|
1450 |
:assigned_to_name => user.login,
|
|
1451 |
:priority_id => 5,
|
|
1452 |
:start_date => '2010-11-07'
|
|
1453 |
}
|
|
1454 |
end
|
|
1455 |
assert_redirected_to :controller => 'issues', :action => 'show', :id => Issue.last.id
|
|
1456 |
|
|
1457 |
issue = Issue.find_by_subject('This is the test_new_with_login issue')
|
|
1458 |
assert_not_nil issue
|
|
1459 |
assert_equal 2, issue.author_id
|
|
1460 |
assert_equal 3, issue.tracker_id
|
|
1461 |
assert_equal 2, issue.status_id
|
|
1462 |
assert_equal 4, issue.assigned_to_id
|
|
1463 |
assert_equal Date.parse('2010-11-07'), issue.start_date
|
|
1464 |
end
|
|
1465 |
|
1440 |
1466 |
context "without workflow privilege" do
|
1441 |
1467 |
setup do
|
1442 |
1468 |
Workflow.delete_all(["role_id = ?", Role.anonymous.id])
|
... | ... | |
1743 |
1769 |
assert mail.subject.include?("(#{ IssueStatus.find(2).name })")
|
1744 |
1770 |
end
|
1745 |
1771 |
|
|
1772 |
def test_put_update_with_status_and_assignee_change_with_login_name
|
|
1773 |
issue = Issue.find(1)
|
|
1774 |
assert_equal 1, issue.status_id
|
|
1775 |
user = User.find(4)
|
|
1776 |
@request.session[:user_id] = 2
|
|
1777 |
assert_difference('TimeEntry.count', 0) do
|
|
1778 |
put :update,
|
|
1779 |
:id => 1,
|
|
1780 |
:issue => { :status_id => 2, :assigned_to_name => user.login },
|
|
1781 |
:notes => 'Assigned to ' + user.login,
|
|
1782 |
:time_entry => { :hours => '', :comments => '', :activity_id => TimeEntryActivity.first }
|
|
1783 |
end
|
|
1784 |
assert_redirected_to :action => 'show', :id => '1'
|
|
1785 |
issue.reload
|
|
1786 |
assert_equal 2, issue.status_id
|
|
1787 |
j = Journal.find(:first, :order => 'id DESC')
|
|
1788 |
assert_equal 'Assigned to ' + user.login, j.notes
|
|
1789 |
assert_equal 2, j.details.size
|
|
1790 |
assert_equal user.id, issue.assigned_to_id
|
|
1791 |
|
|
1792 |
mail = ActionMailer::Base.deliveries.last
|
|
1793 |
assert mail.body.include?("Status changed from New to Assigned")
|
|
1794 |
# subject should contain the new status
|
|
1795 |
assert mail.subject.include?("(#{ IssueStatus.find(2).name })")
|
|
1796 |
end
|
|
1797 |
|
1746 |
1798 |
def test_put_update_with_note_only
|
1747 |
1799 |
notes = 'Note added by IssuesControllerTest#test_update_with_note_only'
|
1748 |
1800 |
# anonymous user
|