Defect #37171 » 0002-Validate-fixed_version_id-to-ensure-that-a-version-w.patch
| app/models/issue.rb | ||
|---|---|---|
| 751 | 751 |
errors.add :start_date, :earlier_than_minimum_start_date, :date => format_date(soonest_start) |
| 752 | 752 |
end |
| 753 | 753 | |
| 754 |
if project && fixed_version |
|
| 755 |
if !assignable_versions.include?(fixed_version)
|
|
| 754 |
if project && fixed_version_id
|
|
| 755 |
if fixed_version.nil? || assignable_versions.exclude?(fixed_version)
|
|
| 756 | 756 |
errors.add :fixed_version_id, :inclusion |
| 757 | 757 |
elsif reopening? && fixed_version.closed? |
| 758 | 758 |
errors.add :base, I18n.t(:error_can_not_reopen_issue_on_closed_version) |
| test/unit/issue_test.rb | ||
|---|---|---|
| 1650 | 1650 |
assert_equal ['open'], issue.assignable_versions.collect(&:status).uniq |
| 1651 | 1651 |
end |
| 1652 | 1652 | |
| 1653 |
def test_should_not_be_able_to_set_an_invalid_version_id |
|
| 1654 |
issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 1, |
|
| 1655 |
:status_id => 1, :fixed_version_id => 424242, |
|
| 1656 |
:subject => 'New issue') |
|
| 1657 |
assert !issue.save |
|
| 1658 |
assert_not_equal [], issue.errors[:fixed_version_id] |
|
| 1659 |
end |
|
| 1660 | ||
| 1653 | 1661 |
def test_should_not_be_able_to_assign_a_new_issue_to_a_closed_version |
| 1654 | 1662 |
issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 1, |
| 1655 | 1663 |
:status_id => 1, :fixed_version_id => 1, |