From 30e6d871ac7e9c915c1208429a14cce71c930fea Mon Sep 17 00:00:00 2001
From: jwollert
Date: Fri, 22 Nov 2013 14:54:12 +0100
Subject: [PATCH] fix work package duplication when not copying any tasks
---
features/edit_story.feature | 37 ++++++++++++++++++++++++++++++
lib/open_project/backlogs/hooks.rb | 8 +++----
2 files changed, 41 insertions(+), 4 deletions(-)
diff --git a/features/edit_story.feature b/features/edit_story.feature
index 63fa3ad811..3ea34ce4f9 100644
--- a/features/edit_story.feature
+++ b/features/edit_story.feature
@@ -62,6 +62,7 @@ Feature: Edit story on backlogs view
| update_stories |
| view_work_packages |
| edit_work_packages |
+ | add_work_packages |
| manage_subtasks |
And the user "mathias" is a "team member"
And the project has the following sprints:
@@ -160,3 +161,39 @@ Feature: Edit story on backlogs view
And I follow "New Story" of the "Sprint 001" menu
And I close the "Sprint 001" menu
Then I should not see "Epic" within_hidden ".type_id.helper"
+
+ @javascript
+ Scenario: Story duplication without copying tasks
+ Given the project has the following tasks:
+ | subject | parent |
+ | Task 1 | Story A |
+ And I am on the work package index page for the project called "ecookbook"
+ And I follow "Story A"
+ And I select "Duplicate" from the action menu
+ And I choose "copy_tasks_none" within "#backlogs-attributes"
+ And I press "Create"
+ Then I should not see "Task 1"
+
+ @javascript
+ Scenario: Story duplication with copying all tasks
+ Given the project has the following tasks:
+ | subject | parent |
+ | Task 1 | Story A |
+ And I am on the work package index page for the project called "ecookbook"
+ And I follow "Story A"
+ And I select "Duplicate" from the action menu
+ And I choose "copy_tasks_all" within "#backlogs-attributes"
+ And I press "Create"
+ Then I should see "Task 1"
+
+ @javascript
+ Scenario: Story duplication with copying open tasks
+ Given the project has the following tasks:
+ | subject | parent |
+ | Task 1 | Story A |
+ And I am on the work package index page for the project called "ecookbook"
+ And I follow "Story A"
+ And I select "Duplicate" from the action menu
+ And I choose "copy_tasks_open" within "#backlogs-attributes"
+ And I press "Create"
+ Then I should see "Task 1"
diff --git a/lib/open_project/backlogs/hooks.rb b/lib/open_project/backlogs/hooks.rb
index 4037308955..7e08e2a1da 100644
--- a/lib/open_project/backlogs/hooks.rb
+++ b/lib/open_project/backlogs/hooks.rb
@@ -137,9 +137,9 @@ module OpenProject::Backlogs::Hooks
snippet << "#{check_box_tag('link_to_original', params[:copy_from], true)}