summaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-01-06 19:50:02 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-01-06 19:50:02 +0000
commitb3c678da871332480526df6ec280f57730f09603 (patch)
tree01e55848aebd513d846d110d8a6b551c7c27cecd /test/unit
parent266521a1d3c687dcb0504c64508977fd087fd22e (diff)
downloadredmine-b3c678da871332480526df6ec280f57730f09603.tar.gz
redmine-b3c678da871332480526df6ec280f57730f09603.zip
Extracted some code from #move_to_project to a callback.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8524 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/issue_test.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb
index 6d090ed52..dc08bbb00 100644
--- a/test/unit/issue_test.rb
+++ b/test/unit/issue_test.rb
@@ -406,6 +406,27 @@ class IssueTest < ActiveSupport::TestCase
assert_equal orig.status, issue.status
end
+ def test_should_not_call_after_project_change_on_creation
+ issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1, :subject => 'Test', :author_id => 1)
+ issue.expects(:after_project_change).never
+ issue.save!
+ end
+
+ def test_should_not_call_after_project_change_on_update
+ issue = Issue.find(1)
+ issue.project = Project.find(1)
+ issue.subject = 'No project change'
+ issue.expects(:after_project_change).never
+ issue.save!
+ end
+
+ def test_should_call_after_project_change_on_project_change
+ issue = Issue.find(1)
+ issue.project = Project.find(2)
+ issue.expects(:after_project_change).once
+ issue.save!
+ end
+
def test_should_close_duplicates
# Create 3 issues
project = Project.find(1)