summaryrefslogtreecommitdiffstats
path: root/test/unit/issue_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/issue_test.rb')
-rw-r--r--test/unit/issue_test.rb60
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