Mercurial > hg > soundsoftware-site
comparison test/unit/issue_status_test.rb @ 1526:404aa68d4227
Merge from live branch
author | Chris Cannam |
---|---|
date | Thu, 11 Sep 2014 12:46:20 +0100 |
parents | dffacf8a6908 |
children |
comparison
equal
deleted
inserted
replaced
1493:a5f2bdf3b486 | 1526:404aa68d4227 |
---|---|
1 # Redmine - project management software | 1 # Redmine - project management software |
2 # Copyright (C) 2006-2012 Jean-Philippe Lang | 2 # Copyright (C) 2006-2014 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 | |
108 with_settings :issue_done_ratio => 'issue_status' do | 107 with_settings :issue_done_ratio => 'issue_status' do |
109 IssueStatus.update_issue_done_ratios | 108 IssueStatus.update_issue_done_ratios |
110 issues = Issue.all(:conditions => {:status_id => 1}) | 109 issues = Issue.where(:status_id => 1) |
111 assert_equal [50], issues.map {|issue| issue.read_attribute(:done_ratio)}.uniq | 110 assert_equal [50], issues.map {|issue| issue.read_attribute(:done_ratio)}.uniq |
112 end | 111 end |
113 end | 112 end |
114 | 113 |
115 def test_sorted_scope | 114 def test_sorted_scope |