Defect #32912 » stale.patch
| object_helpers.rb (working copy) | ||
|---|---|---|
|
def Issue.generate!(attributes={}, &block)
|
||
|
issue = Issue.generate(attributes, &block)
|
||
|
issue.save!
|
||
|
issue
|
||
|
issue.reload
|
||
|
end
|
||
|
# Generates an issue with 2 children and a grandchild
|
||
| unit/issue_test.rb (working copy) | ||
|---|---|---|
|
copy = issue.reload.copy
|
||
|
assert_difference 'Issue.count', 1+issue.descendants.count do
|
||
|
assert copy.save
|
||
|
assert copy.save
|
||
|
assert copy.reload.save
|
||
|
end
|
||
|
end
|
||
| ... | ... | |
|
relation = new_record(IssueRelation) do
|
||
|
copy.save!
|
||
|
end
|
||
|
copy.reload
|
||
|
copy.parent_issue_id = parent.id
|
||
|
assert_save copy
|
||
| ... | ... | |
|
:possible_values => ['value1', 'value2', 'value3'],
|
||
|
:multiple => true)
|
||
|
issue = Issue.create!(:project_id => 1, :tracker_id => 1,
|
||
|
issue = Issue.generate!(:project_id => 1, :tracker_id => 1,
|
||
|
:subject => 'Test', :author_id => 1)
|
||
|
assert_difference 'Journal.count' do
|
||
| unit/project_test.rb (working copy) | ||
|---|---|---|
|
end
|
||
|
def test_destroy_should_destroy_subtasks
|
||
|
issues = (0..2).to_a.map {Issue.create!(:project_id => 1, :tracker_id => 1, :author_id => 1, :subject => 'test')}
|
||
|
issues = (0..2).to_a.map {Issue.generate!(:project_id => 1, :tracker_id => 1, :author_id => 1, :subject => 'test')}
|
||
|
issues[0].update! :parent_issue_id => issues[1].id
|
||
|
issues[2].update! :parent_issue_id => issues[1].id
|
||
|
assert_equal 2, issues[1].children.count
|
||
| unit/user_test.rb (working copy) | ||
|---|---|---|
|
end
|
||
|
def test_destroy_should_update_journals
|
||
|
issue = Issue.create!(:project_id => 1, :author_id => 2,
|
||
|
issue = Issue.generate!(:project_id => 1, :author_id => 2,
|
||
|
:tracker_id => 1, :subject => 'foo')
|
||
|
issue.init_journal(User.find(2), "update")
|
||
|
issue.save!
|
||
| ... | ... | |
|
end
|
||
|
def test_destroy_should_update_journal_details_old_value
|
||
|
issue = Issue.create!(:project_id => 1, :author_id => 1,
|
||
|
issue = Issue.generate!(:project_id => 1, :author_id => 1,
|
||
|
:tracker_id => 1, :subject => 'foo', :assigned_to_id => 2)
|
||
|
issue.init_journal(User.find(1), "update")
|
||
|
issue.assigned_to_id = nil
|
||
| ... | ... | |
|
end
|
||
|
def test_destroy_should_update_journal_details_value
|
||
|
issue = Issue.create!(:project_id => 1, :author_id => 1,
|
||
|
issue = Issue.generate!(:project_id => 1, :author_id => 1,
|
||
|
:tracker_id => 1, :subject => 'foo')
|
||
|
issue.init_journal(User.find(1), "update")
|
||
|
issue.assigned_to_id = 2
|
||