diff options
author | Eric Davis <edavis@littlestreamsoftware.com> | 2009-12-11 18:48:34 +0000 |
---|---|---|
committer | Eric Davis <edavis@littlestreamsoftware.com> | 2009-12-11 18:48:34 +0000 |
commit | 4fe14e71c2d76a2e92da0aaa71e18493d65b1fc1 (patch) | |
tree | 0ef000f0e3985772228928b0acdca1a292f82ef6 /test/unit/issue_test.rb | |
parent | a83501364d0aa5e5e6d7a9e4ccfa2be5dab555b0 (diff) | |
download | redmine-4fe14e71c2d76a2e92da0aaa71e18493d65b1fc1.tar.gz redmine-4fe14e71c2d76a2e92da0aaa71e18493d65b1fc1.zip |
Adds a Setting to control how an Issue's done_ratio is calculated:
* Issue field (default) - the done_ratio field for the Issue
* Issue status - uses the Issue Status's value
#4274
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3151 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/issue_test.rb')
-rw-r--r-- | test/unit/issue_test.rb | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb index e91880c08..fa9d56dbd 100644 --- a/test/unit/issue_test.rb +++ b/test/unit/issue_test.rb @@ -529,4 +529,64 @@ class IssueTest < ActiveSupport::TestCase end assert ActionMailer::Base.deliveries.empty? end + + context "#done_ratio" do + setup do + @issue = Issue.find(1) + @issue_status = IssueStatus.find(1) + @issue_status.update_attribute(:default_done_ratio, 50) + end + + context "with Setting.issue_done_ratio using the issue_field" do + setup do + Setting.issue_done_ratio = 'issue_field' + end + + should "read the issue's field" do + assert_equal 0, @issue.done_ratio + end + end + + context "with Setting.issue_done_ratio using the issue_status" do + setup do + Setting.issue_done_ratio = 'issue_status' + end + + should "read the Issue Status's default done ratio" do + assert_equal 50, @issue.done_ratio + end + end + end + + context "#update_done_ratio_from_issue_status" do + setup do + @issue = Issue.find(1) + @issue_status = IssueStatus.find(1) + @issue_status.update_attribute(:default_done_ratio, 50) + end + + context "with Setting.issue_done_ratio using the issue_field" do + setup do + Setting.issue_done_ratio = 'issue_field' + end + + should "not change the issue" do + @issue.update_done_ratio_from_issue_status + + assert_equal 0, @issue.done_ratio + end + end + + context "with Setting.issue_done_ratio using the issue_status" do + setup do + Setting.issue_done_ratio = 'issue_status' + end + + should "not change the issue's done ratio" do + @issue.update_done_ratio_from_issue_status + + assert_equal 50, @issue.done_ratio + end + end + end end |