diff options
Diffstat (limited to 'features')
-rw-r--r-- | features/project/issues/issues.feature | 2 | ||||
-rw-r--r-- | features/project/merge_requests.feature | 3 | ||||
-rw-r--r-- | features/steps/project/issues/issues.rb | 22 | ||||
-rw-r--r-- | features/steps/project/merge_requests.rb | 12 | ||||
-rw-r--r-- | features/steps/shared/markdown.rb | 29 |
5 files changed, 27 insertions, 41 deletions
diff --git a/features/project/issues/issues.feature b/features/project/issues/issues.feature index e989569ccd4..4db8551559b 100644 --- a/features/project/issues/issues.feature +++ b/features/project/issues/issues.feature @@ -144,7 +144,7 @@ Feature: Project Issues Scenario: Issues list should display task status Given project "Shop" has "Tasks-open" open issue with task markdown When I visit project "Shop" issues page - Then I should see the task status for issue "Tasks-open" + Then I should see the task status for the Taskable # Toggling task items diff --git a/features/project/merge_requests.feature b/features/project/merge_requests.feature index e1e0edd0545..d20358a7dc6 100644 --- a/features/project/merge_requests.feature +++ b/features/project/merge_requests.feature @@ -168,11 +168,10 @@ Feature: Project Merge Requests # Task status in issues list - @now Scenario: Merge requests list should display task status Given project "Shop" has "MR-task-open" open MR with task markdown When I visit project "Shop" merge requests page - Then I should see the task status for merge request "MR-task-open" + Then I should see the task status for the Taskable # Toggling task items diff --git a/features/steps/project/issues/issues.rb b/features/steps/project/issues/issues.rb index 26c3c7c14bc..640603562dd 100644 --- a/features/steps/project/issues/issues.rb +++ b/features/steps/project/issues/issues.rb @@ -154,29 +154,11 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps end step 'project "Shop" has "Tasks-open" open issue with task markdown' do - desc_text = <<EOT.gsub(/^ {6}/, '') - * [ ] Task 1 - * [x] Task 2 -EOT - create(:issue, - title: 'Tasks-open', - project: project, - author: project.users.first, - description: desc_text - ) + create_taskable(:issue, 'Tasks-open') end step 'project "Shop" has "Tasks-closed" closed issue with task markdown' do - desc_text = <<EOT.gsub(/^ {6}/, '') - * [ ] Task 1 - * [x] Task 2 -EOT - create(:closed_issue, - title: 'Tasks-closed', - project: project, - author: project.users.first, - description: desc_text - ) + create_taskable(:closed_issue, 'Tasks-closed') end step 'empty project "Empty Project"' do diff --git a/features/steps/project/merge_requests.rb b/features/steps/project/merge_requests.rb index 0fec2604915..c009568977d 100644 --- a/features/steps/project/merge_requests.rb +++ b/features/steps/project/merge_requests.rb @@ -98,17 +98,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps end step 'project "Shop" has "MR-task-open" open MR with task markdown' do - desc_text = <<EOT.gsub(/^ {6}/, '') - * [ ] Task 1 - * [x] Task 2 -EOT - create(:merge_request, - title: 'MR-task-open', - source_project: project, - target_project: project, - author: project.users.first, - description: desc_text - ) + create_taskable(:merge_request, 'MR-task-open') end step 'I switch to the diff tab' do diff --git a/features/steps/shared/markdown.rb b/features/steps/shared/markdown.rb index 1d9058cf256..8bf138065b0 100644 --- a/features/steps/shared/markdown.rb +++ b/features/steps/shared/markdown.rb @@ -6,6 +6,27 @@ module SharedMarkdown find(:css, "#{parent} h#{level}##{id} > :last-child")[:href].should =~ /##{id}$/ end + def create_taskable(type, title) + desc_text = <<EOT.gsub(/^ {6}/, '') + * [ ] Task 1 + * [x] Task 2 +EOT + + case type + when :issue, :closed_issue + options = { project: project } + when :merge_request + options = { source_project: project, target_project: project } + end + + create( + type, + options.merge(title: title, + author: project.users.first, + description: desc_text) + ) + end + step 'Header "Description header" should have correct id and link' do header_should_have_correct_id_and_link(1, 'Description header', 'description-header') end @@ -16,13 +37,7 @@ module SharedMarkdown ) end - step 'I should see the task status for issue "Tasks-open"' do - expect(find(:css, 'span.task-status').text).to eq( - '2 tasks (1 done, 1 unfinished)' - ) - end - - step 'I should see the task status for merge request "MR-task-open"' do + step 'I should see the task status for the Taskable' do expect(find(:css, 'span.task-status').text).to eq( '2 tasks (1 done, 1 unfinished)' ) |