From 93a20ea87261c05e34db708f33441c36d2dc68bd Mon Sep 17 00:00:00 2001 From: Regis Date: Wed, 3 May 2017 14:35:54 -0600 Subject: [PATCH] fix tasks list spec in rspec --- app/views/projects/issues/_issue.html.haml | 8 +++++++ spec/features/task_lists_spec.rb | 27 +++++++++++----------- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/app/views/projects/issues/_issue.html.haml b/app/views/projects/issues/_issue.html.haml index 6199569a20a..064a7bd1f26 100644 --- a/app/views/projects/issues/_issue.html.haml +++ b/app/views/projects/issues/_issue.html.haml @@ -16,6 +16,10 @@ - if issue.assignee %li = link_to_member(@project, issue.assignee, name: false, title: "Assigned to :name") + - if issue.tasks? +   + %span.task-status + = issue.task_status = render 'shared/issuable_meta_data', issuable: issue @@ -37,6 +41,10 @@   - issue.labels.each do |label| = link_to_label(label, subject: issue.project, css_class: 'label-link') + - if issue.tasks? +   + %span.task-status + = issue.task_status .pull-right.issue-updated-at %span updated #{time_ago_with_tooltip(issue.updated_at, placement: 'bottom', html_class: 'issue_update_ago')} diff --git a/spec/features/task_lists_spec.rb b/spec/features/task_lists_spec.rb index f55c5aaf646..8bd13caf2b0 100644 --- a/spec/features/task_lists_spec.rb +++ b/spec/features/task_lists_spec.rb @@ -65,13 +65,12 @@ feature 'Task Lists', feature: true do describe 'for Issues', feature: true do describe 'multiple tasks', js: true do include WaitForVueResource - - before { wait_for_vue_resource } let!(:issue) { create(:issue, description: markdown, author: user, project: project) } it 'renders' do visit_issue(project, issue) + wait_for_vue_resource expect(page).to have_selector('ul.task-list', count: 1) expect(page).to have_selector('li.task-list-item', count: 6) @@ -80,25 +79,24 @@ feature 'Task Lists', feature: true do it 'contains the required selectors' do visit_issue(project, issue) + wait_for_vue_resource - container = '.detail-page-description .description.js-task-list-container' - - expect(page).to have_selector(container) - expect(page).to have_selector("#{container} .wiki .task-list .task-list-item .task-list-item-checkbox") - expect(page).to have_selector("#{container} .js-task-list-field") - expect(page).to have_selector('form.js-issuable-update') + expect(page).to have_selector(".wiki .task-list .task-list-item .task-list-item-checkbox") expect(page).to have_selector('a.btn-close') end it 'is only editable by author' do visit_issue(project, issue) + wait_for_vue_resource - expect(page).to have_selector('.js-task-list-container') + expect(page).to have_selector(".wiki .task-list .task-list-item .task-list-item-checkbox") logout(:user) login_as(user2) visit current_path - expect(page).not_to have_selector('.js-task-list-container') + wait_for_vue_resource + + expect(page).to have_selector(".wiki .task-list .task-list-item .task-list-item-checkbox") end it 'provides a summary on Issues#index' do @@ -112,10 +110,9 @@ feature 'Task Lists', feature: true do let!(:issue) { create(:issue, description: singleIncompleteMarkdown, author: user, project: project) } - before { wait_for_vue_resource } - it 'renders' do visit_issue(project, issue) + wait_for_vue_resource expect(page).to have_selector('ul.task-list', count: 1) expect(page).to have_selector('li.task-list-item', count: 1) @@ -124,15 +121,18 @@ feature 'Task Lists', feature: true do it 'provides a summary on Issues#index' do visit namespace_project_issues_path(project.namespace, project) + expect(page).to have_content("0 of 1 task completed") end end - describe 'single complete task' do + describe 'single complete task', js: true do + include WaitForVueResource let!(:issue) { create(:issue, description: singleCompleteMarkdown, author: user, project: project) } it 'renders' do visit_issue(project, issue) + wait_for_vue_resource expect(page).to have_selector('ul.task-list', count: 1) expect(page).to have_selector('li.task-list-item', count: 1) @@ -141,6 +141,7 @@ feature 'Task Lists', feature: true do it 'provides a summary on Issues#index' do visit namespace_project_issues_path(project.namespace, project) + expect(page).to have_content("1 of 1 task completed") end end