diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-01-31 18:15:32 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-01-31 18:15:32 +0000 |
commit | 1b911e51f9625082a5e61ca62a78db284383c1d2 (patch) | |
tree | dc5d993becd523cb4c1610fc5f865934e771623f /test/unit/project_copy_test.rb | |
parent | 10ebed3b97b8990a721e666dccbb607d78dc38be (diff) | |
download | redmine-1b911e51f9625082a5e61ca62a78db284383c1d2.tar.gz redmine-1b911e51f9625082a5e61ca62a78db284383c1d2.zip |
Time entry queries should be copied and deleted too.
git-svn-id: http://svn.redmine.org/redmine/trunk@16320 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/project_copy_test.rb')
-rw-r--r-- | test/unit/project_copy_test.rb | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/test/unit/project_copy_test.rb b/test/unit/project_copy_test.rb index 9370bebf4..0b2c1e63d 100644 --- a/test/unit/project_copy_test.rb +++ b/test/unit/project_copy_test.rb @@ -235,17 +235,28 @@ class ProjectCopyTest < ActiveSupport::TestCase assert_equal [1, 2], member.role_ids.sort end - test "#copy should copy project specific queries" do - assert @project.valid? - assert @project.queries.empty? - assert @project.copy(@source_project) + def test_copy_should_copy_project_specific_issue_queries + source = Project.generate! + target = Project.new(:name => 'Copy Test', :identifier => 'copy-test') + IssueQuery.generate!(:project => source, :user => User.find(2)) + assert target.copy(source) - assert_equal @source_project.queries.size, @project.queries.size - @project.queries.each do |query| - assert query - assert_equal @project, query.project - end - assert_equal @source_project.queries.map(&:user_id).sort, @project.queries.map(&:user_id).sort + assert_equal 1, target.queries.size + query = target.queries.first + assert_kind_of IssueQuery, query + assert_equal 2, query.user_id + end + + def test_copy_should_copy_project_specific_time_entry_queries + source = Project.generate! + target = Project.new(:name => 'Copy Test', :identifier => 'copy-test') + TimeEntryQuery.generate!(:project => source, :user => User.find(2)) + assert target.copy(source) + + assert_equal 1, target.queries.size + query = target.queries.first + assert_kind_of TimeEntryQuery, query + assert_equal 2, query.user_id end def test_copy_should_copy_queries_roles_visibility |