Mercurial > hg > soundsoftware-site
comparison test/unit/issue_status_test.rb @ 1464:261b3d9a4903 redmine-2.4
Update to Redmine 2.4 branch rev 12663
| author | Chris Cannam |
|---|---|
| date | Tue, 14 Jan 2014 14:37:42 +0000 |
| parents | 433d4f72a19b |
| children | e248c7af89ec |
comparison
equal
deleted
inserted
replaced
| 1296:038ba2d95de8 | 1464:261b3d9a4903 |
|---|---|
| 1 # Redmine - project management software | 1 # Redmine - project management software |
| 2 # Copyright (C) 2006-2012 Jean-Philippe Lang | 2 # Copyright (C) 2006-2013 Jean-Philippe Lang |
| 3 # | 3 # |
| 4 # This program is free software; you can redistribute it and/or | 4 # This program is free software; you can redistribute it and/or |
| 5 # modify it under the terms of the GNU General Public License | 5 # modify it under the terms of the GNU General Public License |
| 6 # as published by the Free Software Foundation; either version 2 | 6 # as published by the Free Software Foundation; either version 2 |
| 7 # of the License, or (at your option) any later version. | 7 # of the License, or (at your option) any later version. |
| 34 def test_destroy | 34 def test_destroy |
| 35 status = IssueStatus.find(3) | 35 status = IssueStatus.find(3) |
| 36 assert_difference 'IssueStatus.count', -1 do | 36 assert_difference 'IssueStatus.count', -1 do |
| 37 assert status.destroy | 37 assert status.destroy |
| 38 end | 38 end |
| 39 assert_nil WorkflowTransition.first(:conditions => {:old_status_id => status.id}) | 39 assert_nil WorkflowTransition.where(:old_status_id => status.id).first |
| 40 assert_nil WorkflowTransition.first(:conditions => {:new_status_id => status.id}) | 40 assert_nil WorkflowTransition.where(:new_status_id => status.id).first |
| 41 end | 41 end |
| 42 | 42 |
| 43 def test_destroy_status_in_use | 43 def test_destroy_status_in_use |
| 44 # Status assigned to an Issue | 44 # Status assigned to an Issue |
| 45 status = Issue.find(1).status | 45 status = Issue.find(1).status |
| 96 def test_update_done_ratios_with_issue_done_ratio_set_to_issue_field_should_change_nothing | 96 def test_update_done_ratios_with_issue_done_ratio_set_to_issue_field_should_change_nothing |
| 97 IssueStatus.find(1).update_attribute(:default_done_ratio, 50) | 97 IssueStatus.find(1).update_attribute(:default_done_ratio, 50) |
| 98 | 98 |
| 99 with_settings :issue_done_ratio => 'issue_field' do | 99 with_settings :issue_done_ratio => 'issue_field' do |
| 100 IssueStatus.update_issue_done_ratios | 100 IssueStatus.update_issue_done_ratios |
| 101 assert_equal 0, Issue.count(:conditions => {:done_ratio => 50}) | 101 assert_equal 0, Issue.where(:done_ratio => 50).count |
| 102 end | 102 end |
| 103 end | 103 end |
| 104 | 104 |
| 105 def test_update_done_ratios_with_issue_done_ratio_set_to_issue_status_should_update_issues | 105 def test_update_done_ratios_with_issue_done_ratio_set_to_issue_status_should_update_issues |
| 106 IssueStatus.find(1).update_attribute(:default_done_ratio, 50) | 106 IssueStatus.find(1).update_attribute(:default_done_ratio, 50) |
| 107 | 107 |
| 108 with_settings :issue_done_ratio => 'issue_status' do | 108 with_settings :issue_done_ratio => 'issue_status' do |
| 109 IssueStatus.update_issue_done_ratios | 109 IssueStatus.update_issue_done_ratios |
| 110 issues = Issue.all(:conditions => {:status_id => 1}) | 110 issues = Issue.where(:status_id => 1).all |
| 111 assert_equal [50], issues.map {|issue| issue.read_attribute(:done_ratio)}.uniq | 111 assert_equal [50], issues.map {|issue| issue.read_attribute(:done_ratio)}.uniq |
| 112 end | 112 end |
| 113 end | 113 end |
| 114 | 114 |
| 115 def test_sorted_scope | 115 def test_sorted_scope |
