summaryrefslogtreecommitdiffstats
path: root/test/unit/issue_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2014-10-25 09:35:17 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2014-10-25 09:35:17 +0000
commitc0f082ad0252b1da280c0ba61f750046c461976b (patch)
treeb26bcef9a7a38d8141462636114e200c97fe19dd /test/unit/issue_test.rb
parentcaccb57b55f7b9f3c1a3ee74e649804698481ce6 (diff)
downloadredmine-c0f082ad0252b1da280c0ba61f750046c461976b.tar.gz
redmine-c0f082ad0252b1da280c0ba61f750046c461976b.zip
Code cleanup.
git-svn-id: http://svn.redmine.org/redmine/trunk@13508 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/issue_test.rb')
-rw-r--r--test/unit/issue_test.rb75
1 files changed, 75 insertions, 0 deletions
diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb
index 2cf00f5ff..834792458 100644
--- a/test/unit/issue_test.rb
+++ b/test/unit/issue_test.rb
@@ -2398,6 +2398,13 @@ class IssueTest < ActiveSupport::TestCase
assert_equal IssueStatus.find(1), issue.status_was
end
+ def test_status_was_should_return_status_before_change_with_status_id
+ issue = Issue.find(1)
+ assert_equal IssueStatus.find(1), issue.status
+ issue.status_id = 2
+ assert_equal IssueStatus.find(1), issue.status_was
+ end
+
def test_status_was_should_be_reset_on_save
issue = Issue.find(1)
issue.status = IssueStatus.find(2)
@@ -2405,4 +2412,72 @@ class IssueTest < ActiveSupport::TestCase
assert issue.save!
assert_equal IssueStatus.find(2), issue.status_was
end
+
+ def test_closing_should_return_true_when_closing_an_issue
+ issue = Issue.find(1)
+ issue.status = IssueStatus.find(2)
+ assert_equal false, issue.closing?
+ issue.status = IssueStatus.find(5)
+ assert_equal true, issue.closing?
+ end
+
+ def test_closing_should_return_true_when_closing_an_issue_with_status_id
+ issue = Issue.find(1)
+ issue.status_id = 2
+ assert_equal false, issue.closing?
+ issue.status_id = 5
+ assert_equal true, issue.closing?
+ end
+
+ def test_closing_should_return_true_for_new_closed_issue
+ issue = Issue.new
+ assert_equal false, issue.closing?
+ issue.status = IssueStatus.find(5)
+ assert_equal true, issue.closing?
+ end
+
+ def test_closing_should_return_true_for_new_closed_issue_with_status_id
+ issue = Issue.new
+ assert_equal false, issue.closing?
+ issue.status_id = 5
+ assert_equal true, issue.closing?
+ end
+
+ def test_closing_should_be_reset_after_save
+ issue = Issue.find(1)
+ issue.status_id = 5
+ assert_equal true, issue.closing?
+ issue.save!
+ assert_equal false, issue.closing?
+ end
+
+ def test_reopening_should_return_true_when_reopening_an_issue
+ issue = Issue.find(8)
+ issue.status = IssueStatus.find(6)
+ assert_equal false, issue.reopening?
+ issue.status = IssueStatus.find(2)
+ assert_equal true, issue.reopening?
+ end
+
+ def test_reopening_should_return_true_when_reopening_an_issue_with_status_id
+ issue = Issue.find(8)
+ issue.status_id = 6
+ assert_equal false, issue.reopening?
+ issue.status_id = 2
+ assert_equal true, issue.reopening?
+ end
+
+ def test_reopening_should_return_false_for_new_open_issue
+ issue = Issue.new
+ issue.status = IssueStatus.find(1)
+ assert_equal false, issue.reopening?
+ end
+
+ def test_reopening_should_be_reset_after_save
+ issue = Issue.find(8)
+ issue.status_id = 2
+ assert_equal true, issue.reopening?
+ issue.save!
+ assert_equal false, issue.reopening?
+ end
end