@@ -137,7 +137,7 class IssueTest < ActiveSupport::TestCase | |||||
137 | def test_create_with_required_custom_field |
|
137 | def test_create_with_required_custom_field | |
138 | set_language_if_valid 'en' |
|
138 | set_language_if_valid 'en' | |
139 | field = IssueCustomField.find_by_name('Database') |
|
139 | field = IssueCustomField.find_by_name('Database') | |
140 |
field.update |
|
140 | field.update!(:is_required => true) | |
141 |
|
141 | |||
142 | issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 1, |
|
142 | issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 1, | |
143 | :status_id => 1, :subject => 'test_create', |
|
143 | :status_id => 1, :subject => 'test_create', | |
@@ -242,14 +242,14 class IssueTest < ActiveSupport::TestCase | |||||
242 | end |
|
242 | end | |
243 |
|
243 | |||
244 | def test_anonymous_should_not_see_private_issues_with_issues_visibility_set_to_default |
|
244 | def test_anonymous_should_not_see_private_issues_with_issues_visibility_set_to_default | |
245 |
|
|
245 | Role.anonymous.update!(:issues_visibility => 'default') | |
246 | issue = Issue.generate!(:author => User.anonymous, :assigned_to => User.anonymous, :is_private => true) |
|
246 | issue = Issue.generate!(:author => User.anonymous, :assigned_to => User.anonymous, :is_private => true) | |
247 | assert_nil Issue.where(:id => issue.id).visible(User.anonymous).first |
|
247 | assert_nil Issue.where(:id => issue.id).visible(User.anonymous).first | |
248 | assert !issue.visible?(User.anonymous) |
|
248 | assert !issue.visible?(User.anonymous) | |
249 | end |
|
249 | end | |
250 |
|
250 | |||
251 | def test_anonymous_should_not_see_private_issues_with_issues_visibility_set_to_own |
|
251 | def test_anonymous_should_not_see_private_issues_with_issues_visibility_set_to_own | |
252 |
assert Role.anonymous.update |
|
252 | assert Role.anonymous.update!(:issues_visibility => 'own') | |
253 | issue = Issue.generate!(:author => User.anonymous, :assigned_to => User.anonymous, :is_private => true) |
|
253 | issue = Issue.generate!(:author => User.anonymous, :assigned_to => User.anonymous, :is_private => true) | |
254 | assert_nil Issue.where(:id => issue.id).visible(User.anonymous).first |
|
254 | assert_nil Issue.where(:id => issue.id).visible(User.anonymous).first | |
255 | assert !issue.visible?(User.anonymous) |
|
255 | assert !issue.visible?(User.anonymous) | |
@@ -267,7 +267,7 class IssueTest < ActiveSupport::TestCase | |||||
267 | end |
|
267 | end | |
268 |
|
268 | |||
269 | def test_visible_scope_for_non_member_with_own_issues_visibility |
|
269 | def test_visible_scope_for_non_member_with_own_issues_visibility | |
270 |
Role.non_member.update |
|
270 | Role.non_member.update! :issues_visibility => 'own' | |
271 | Issue.create!(:project_id => 1, :tracker_id => 1, :author_id => 9, :subject => 'Issue by non member') |
|
271 | Issue.create!(:project_id => 1, :tracker_id => 1, :author_id => 9, :subject => 'Issue by non member') | |
272 | user = User.find(9) |
|
272 | user = User.find(9) | |
273 |
|
273 | |||
@@ -331,12 +331,12 class IssueTest < ActiveSupport::TestCase | |||||
331 | :assigned_to => user.groups.first, |
|
331 | :assigned_to => user.groups.first, | |
332 | :is_private => true) |
|
332 | :is_private => true) | |
333 |
|
333 | |||
334 |
Role.find(2).update |
|
334 | Role.find(2).update! :issues_visibility => 'default' | |
335 | issues = Issue.visible(User.find(8)).to_a |
|
335 | issues = Issue.visible(User.find(8)).to_a | |
336 | assert issues.any? |
|
336 | assert issues.any? | |
337 | assert issues.include?(issue) |
|
337 | assert issues.include?(issue) | |
338 |
|
338 | |||
339 |
Role.find(2).update |
|
339 | Role.find(2).update! :issues_visibility => 'own' | |
340 | issues = Issue.visible(User.find(8)).to_a |
|
340 | issues = Issue.visible(User.find(8)).to_a | |
341 | assert issues.any? |
|
341 | assert issues.any? | |
342 | assert_include issue, issues |
|
342 | assert_include issue, issues | |
@@ -515,7 +515,7 class IssueTest < ActiveSupport::TestCase | |||||
515 |
|
515 | |||
516 | def test_update_issue_with_required_custom_field |
|
516 | def test_update_issue_with_required_custom_field | |
517 | field = IssueCustomField.find_by_name('Database') |
|
517 | field = IssueCustomField.find_by_name('Database') | |
518 |
field.update |
|
518 | field.update!(:is_required => true) | |
519 |
|
519 | |||
520 | issue = Issue.find(1) |
|
520 | issue = Issue.find(1) | |
521 | assert_nil issue.custom_value_for(field) |
|
521 | assert_nil issue.custom_value_for(field) | |
@@ -561,7 +561,7 class IssueTest < ActiveSupport::TestCase | |||||
561 |
|
561 | |||
562 | def test_setting_project_should_set_version_to_default_version |
|
562 | def test_setting_project_should_set_version_to_default_version | |
563 | version = Version.generate!(:project_id => 1) |
|
563 | version = Version.generate!(:project_id => 1) | |
564 |
Project.find(1).update |
|
564 | Project.find(1).update!(:default_version_id => version.id) | |
565 |
|
565 | |||
566 | issue = Issue.new(:project_id => 1) |
|
566 | issue = Issue.new(:project_id => 1) | |
567 | assert_equal version, issue.fixed_version |
|
567 | assert_equal version, issue.fixed_version | |
@@ -1477,7 +1477,7 class IssueTest < ActiveSupport::TestCase | |||||
1477 | end |
|
1477 | end | |
1478 |
|
1478 | |||
1479 | def test_should_keep_shared_version_when_changing_project |
|
1479 | def test_should_keep_shared_version_when_changing_project | |
1480 |
Version.find(2).update |
|
1480 | Version.find(2).update! :sharing => 'tree' | |
1481 |
|
1481 | |||
1482 | issue = Issue.find(2) |
|
1482 | issue = Issue.find(2) | |
1483 | assert_equal 2, issue.fixed_version_id |
|
1483 | assert_equal 2, issue.fixed_version_id | |
@@ -1610,7 +1610,7 class IssueTest < ActiveSupport::TestCase | |||||
1610 |
|
1610 | |||
1611 | def test_move_to_another_project_should_clear_fixed_version_when_not_shared |
|
1611 | def test_move_to_another_project_should_clear_fixed_version_when_not_shared | |
1612 | issue = Issue.find(1) |
|
1612 | issue = Issue.find(1) | |
1613 |
issue.update |
|
1613 | issue.update!(:fixed_version_id => 3) | |
1614 | issue.project = Project.find(2) |
|
1614 | issue.project = Project.find(2) | |
1615 | assert issue.save |
|
1615 | assert issue.save | |
1616 | issue.reload |
|
1616 | issue.reload | |
@@ -1621,7 +1621,7 class IssueTest < ActiveSupport::TestCase | |||||
1621 |
|
1621 | |||
1622 | def test_move_to_another_project_should_keep_fixed_version_when_shared_with_the_target_project |
|
1622 | def test_move_to_another_project_should_keep_fixed_version_when_shared_with_the_target_project | |
1623 | issue = Issue.find(1) |
|
1623 | issue = Issue.find(1) | |
1624 |
issue.update |
|
1624 | issue.update!(:fixed_version_id => 4) | |
1625 | issue.project = Project.find(5) |
|
1625 | issue.project = Project.find(5) | |
1626 | assert issue.save |
|
1626 | assert issue.save | |
1627 | issue.reload |
|
1627 | issue.reload | |
@@ -1632,7 +1632,7 class IssueTest < ActiveSupport::TestCase | |||||
1632 |
|
1632 | |||
1633 | def test_move_to_another_project_should_clear_fixed_version_when_not_shared_with_the_target_project |
|
1633 | def test_move_to_another_project_should_clear_fixed_version_when_not_shared_with_the_target_project | |
1634 | issue = Issue.find(1) |
|
1634 | issue = Issue.find(1) | |
1635 |
issue.update |
|
1635 | issue.update!(:fixed_version_id => 3) | |
1636 | issue.project = Project.find(5) |
|
1636 | issue.project = Project.find(5) | |
1637 | assert issue.save |
|
1637 | assert issue.save | |
1638 | issue.reload |
|
1638 | issue.reload | |
@@ -1643,7 +1643,7 class IssueTest < ActiveSupport::TestCase | |||||
1643 |
|
1643 | |||
1644 | def test_move_to_another_project_should_keep_fixed_version_when_shared_systemwide |
|
1644 | def test_move_to_another_project_should_keep_fixed_version_when_shared_systemwide | |
1645 | issue = Issue.find(1) |
|
1645 | issue = Issue.find(1) | |
1646 |
issue.update |
|
1646 | issue.update!(:fixed_version_id => 7) | |
1647 | issue.project = Project.find(2) |
|
1647 | issue.project = Project.find(2) | |
1648 | assert issue.save |
|
1648 | assert issue.save | |
1649 | issue.reload |
|
1649 | issue.reload | |
@@ -1654,7 +1654,7 class IssueTest < ActiveSupport::TestCase | |||||
1654 |
|
1654 | |||
1655 | def test_move_to_another_project_should_keep_parent_if_valid |
|
1655 | def test_move_to_another_project_should_keep_parent_if_valid | |
1656 | issue = Issue.find(1) |
|
1656 | issue = Issue.find(1) | |
1657 |
issue.update |
|
1657 | issue.update! :parent_issue_id => 2 | |
1658 | issue.project = Project.find(3) |
|
1658 | issue.project = Project.find(3) | |
1659 | assert issue.save |
|
1659 | assert issue.save | |
1660 | issue.reload |
|
1660 | issue.reload | |
@@ -1663,7 +1663,7 class IssueTest < ActiveSupport::TestCase | |||||
1663 |
|
1663 | |||
1664 | def test_move_to_another_project_should_clear_parent_if_not_valid |
|
1664 | def test_move_to_another_project_should_clear_parent_if_not_valid | |
1665 | issue = Issue.find(1) |
|
1665 | issue = Issue.find(1) | |
1666 |
issue.update |
|
1666 | issue.update! :parent_issue_id => 2 | |
1667 | issue.project = Project.find(2) |
|
1667 | issue.project = Project.find(2) | |
1668 | assert issue.save |
|
1668 | assert issue.save | |
1669 | issue.reload |
|
1669 | issue.reload | |
@@ -1799,7 +1799,7 class IssueTest < ActiveSupport::TestCase | |||||
1799 | def test_recipients_should_include_previous_assignee |
|
1799 | def test_recipients_should_include_previous_assignee | |
1800 | user = User.find(3) |
|
1800 | user = User.find(3) | |
1801 | user.members.update_all ["mail_notification = ?", false] |
|
1801 | user.members.update_all ["mail_notification = ?", false] | |
1802 |
user.update |
|
1802 | user.update! :mail_notification => 'only_assigned' | |
1803 |
|
1803 | |||
1804 | issue = Issue.find(2) |
|
1804 | issue = Issue.find(2) | |
1805 | issue.assigned_to = nil |
|
1805 | issue.assigned_to = nil | |
@@ -1864,7 +1864,7 class IssueTest < ActiveSupport::TestCase | |||||
1864 |
|
1864 | |||
1865 | def test_destroying_a_stale_issue_should_not_raise_an_error |
|
1865 | def test_destroying_a_stale_issue_should_not_raise_an_error | |
1866 | issue = Issue.find(1) |
|
1866 | issue = Issue.find(1) | |
1867 |
Issue.find(1).update |
|
1867 | Issue.find(1).update! :subject => "Updated" | |
1868 |
|
1868 | |||
1869 | assert_nothing_raised do |
|
1869 | assert_nothing_raised do | |
1870 | assert_difference 'Issue.count', -1 do |
|
1870 | assert_difference 'Issue.count', -1 do | |
@@ -2345,7 +2345,7 class IssueTest < ActiveSupport::TestCase | |||||
2345 | ActionMailer::Base.deliveries.clear |
|
2345 | ActionMailer::Base.deliveries.clear | |
2346 | user = User.find(3) |
|
2346 | user = User.find(3) | |
2347 | user.members.update_all ["mail_notification = ?", false] |
|
2347 | user.members.update_all ["mail_notification = ?", false] | |
2348 |
user.update |
|
2348 | user.update! :mail_notification => 'only_assigned' | |
2349 |
|
2349 | |||
2350 | with_settings :notified_events => %w(issue_updated) do |
|
2350 | with_settings :notified_events => %w(issue_updated) do | |
2351 | issue = Issue.find(2) |
|
2351 | issue = Issue.find(2) | |
@@ -2482,10 +2482,10 class IssueTest < ActiveSupport::TestCase | |||||
2482 | test "#done_ratio should use the issue_status according to Setting.issue_done_ratio" do |
|
2482 | test "#done_ratio should use the issue_status according to Setting.issue_done_ratio" do | |
2483 | @issue = Issue.find(1) |
|
2483 | @issue = Issue.find(1) | |
2484 | @issue_status = IssueStatus.find(1) |
|
2484 | @issue_status = IssueStatus.find(1) | |
2485 |
@issue_status.update |
|
2485 | @issue_status.update!(:default_done_ratio => 50) | |
2486 | @issue2 = Issue.find(2) |
|
2486 | @issue2 = Issue.find(2) | |
2487 | @issue_status2 = IssueStatus.find(2) |
|
2487 | @issue_status2 = IssueStatus.find(2) | |
2488 |
@issue_status2.update |
|
2488 | @issue_status2.update!(:default_done_ratio => 0) | |
2489 |
|
2489 | |||
2490 | with_settings :issue_done_ratio => 'issue_field' do |
|
2490 | with_settings :issue_done_ratio => 'issue_field' do | |
2491 | assert_equal 0, @issue.done_ratio |
|
2491 | assert_equal 0, @issue.done_ratio | |
@@ -2501,10 +2501,10 class IssueTest < ActiveSupport::TestCase | |||||
2501 | test "#update_done_ratio_from_issue_status should update done_ratio according to Setting.issue_done_ratio" do |
|
2501 | test "#update_done_ratio_from_issue_status should update done_ratio according to Setting.issue_done_ratio" do | |
2502 | @issue = Issue.find(1) |
|
2502 | @issue = Issue.find(1) | |
2503 | @issue_status = IssueStatus.find(1) |
|
2503 | @issue_status = IssueStatus.find(1) | |
2504 |
@issue_status.update |
|
2504 | @issue_status.update!(:default_done_ratio => 50) | |
2505 | @issue2 = Issue.find(2) |
|
2505 | @issue2 = Issue.find(2) | |
2506 | @issue_status2 = IssueStatus.find(2) |
|
2506 | @issue_status2 = IssueStatus.find(2) | |
2507 |
@issue_status2.update |
|
2507 | @issue_status2.update!(:default_done_ratio => 0) | |
2508 |
|
2508 | |||
2509 | with_settings :issue_done_ratio => 'issue_field' do |
|
2509 | with_settings :issue_done_ratio => 'issue_field' do | |
2510 | @issue.update_done_ratio_from_issue_status |
|
2510 | @issue.update_done_ratio_from_issue_status | |
@@ -2614,19 +2614,19 class IssueTest < ActiveSupport::TestCase | |||||
2614 |
|
2614 | |||
2615 | test "Issue#recipients should not include users who opt out of all email" do |
|
2615 | test "Issue#recipients should not include users who opt out of all email" do | |
2616 | issue = Issue.generate!(:author => User.generate!) |
|
2616 | issue = Issue.generate!(:author => User.generate!) | |
2617 |
issue.author.update |
|
2617 | issue.author.update!(:mail_notification => :none) | |
2618 | assert !issue.recipients.include?(issue.author.mail) |
|
2618 | assert !issue.recipients.include?(issue.author.mail) | |
2619 | end |
|
2619 | end | |
2620 |
|
2620 | |||
2621 | test "Issue#recipients should not include the issue author if they are only notified of assigned issues" do |
|
2621 | test "Issue#recipients should not include the issue author if they are only notified of assigned issues" do | |
2622 | issue = Issue.generate!(:author => User.generate!) |
|
2622 | issue = Issue.generate!(:author => User.generate!) | |
2623 |
issue.author.update |
|
2623 | issue.author.update!(:mail_notification => :only_assigned) | |
2624 | assert !issue.recipients.include?(issue.author.mail) |
|
2624 | assert !issue.recipients.include?(issue.author.mail) | |
2625 | end |
|
2625 | end | |
2626 |
|
2626 | |||
2627 | test "Issue#recipients should not include the assigned user if they are only notified of owned issues" do |
|
2627 | test "Issue#recipients should not include the assigned user if they are only notified of owned issues" do | |
2628 | issue = Issue.generate!(:assigned_to => User.generate!) |
|
2628 | issue = Issue.generate!(:assigned_to => User.generate!) | |
2629 |
issue.assigned_to.update |
|
2629 | issue.assigned_to.update!(:mail_notification => :only_owner) | |
2630 | assert !issue.recipients.include?(issue.assigned_to.mail) |
|
2630 | assert !issue.recipients.include?(issue.assigned_to.mail) | |
2631 | end |
|
2631 | end | |
2632 |
|
2632 | |||
@@ -2921,10 +2921,10 class IssueTest < ActiveSupport::TestCase | |||||
2921 |
|
2921 | |||
2922 | def test_issue_overdue_should_respect_user_timezone |
|
2922 | def test_issue_overdue_should_respect_user_timezone | |
2923 | user_in_europe = users(:users_001) |
|
2923 | user_in_europe = users(:users_001) | |
2924 |
user_in_europe.pref.update |
|
2924 | user_in_europe.pref.update! :time_zone => 'UTC' | |
2925 |
|
2925 | |||
2926 | user_in_asia = users(:users_002) |
|
2926 | user_in_asia = users(:users_002) | |
2927 |
user_in_asia.pref.update |
|
2927 | user_in_asia.pref.update! :time_zone => 'Hongkong' | |
2928 |
|
2928 | |||
2929 | issue = Issue.generate! :due_date => Date.parse('2016-03-20') |
|
2929 | issue = Issue.generate! :due_date => Date.parse('2016-03-20') | |
2930 |
|
2930 |
General Comments 0
You need to be logged in to leave comments.
Login now