2016-06-07 05:18:57 -04:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2017-10-03 04:35:01 -04:00
|
|
|
feature 'Manually create a todo item from issue', :js do
|
2017-08-02 15:55:11 -04:00
|
|
|
let!(:project) { create(:project) }
|
2017-07-26 17:49:06 -04:00
|
|
|
let!(:issue) { create(:issue, project: project) }
|
|
|
|
let!(:user) { create(:user)}
|
2016-06-07 05:18:57 -04:00
|
|
|
|
|
|
|
before do
|
2017-12-22 03:18:28 -05:00
|
|
|
project.add_master(user)
|
2017-06-21 19:44:10 -04:00
|
|
|
sign_in(user)
|
2017-07-06 12:20:50 -04:00
|
|
|
visit project_issue_path(project, issue)
|
2016-06-07 05:18:57 -04:00
|
|
|
end
|
|
|
|
|
2016-07-25 14:16:19 -04:00
|
|
|
it 'creates todo when clicking button' do
|
2016-06-07 05:18:57 -04:00
|
|
|
page.within '.issuable-sidebar' do
|
2016-11-23 18:34:58 -05:00
|
|
|
click_button 'Add todo'
|
2018-04-19 10:43:20 -04:00
|
|
|
expect(page).to have_content 'Mark todo as done'
|
2016-06-07 05:18:57 -04:00
|
|
|
end
|
|
|
|
|
2017-03-29 17:16:57 -04:00
|
|
|
page.within '.header-content .todos-count' do
|
2016-06-07 05:18:57 -04:00
|
|
|
expect(page).to have_content '1'
|
|
|
|
end
|
2016-06-17 04:01:03 -04:00
|
|
|
|
2017-07-06 12:20:50 -04:00
|
|
|
visit project_issue_path(project, issue)
|
2016-06-17 04:01:03 -04:00
|
|
|
|
2017-03-29 17:16:57 -04:00
|
|
|
page.within '.header-content .todos-count' do
|
2016-06-17 04:01:03 -04:00
|
|
|
expect(page).to have_content '1'
|
|
|
|
end
|
2016-06-07 05:18:57 -04:00
|
|
|
end
|
|
|
|
|
2016-07-25 14:16:19 -04:00
|
|
|
it 'marks a todo as done' do
|
2016-06-07 05:18:57 -04:00
|
|
|
page.within '.issuable-sidebar' do
|
2016-11-23 18:34:58 -05:00
|
|
|
click_button 'Add todo'
|
2018-04-19 10:43:20 -04:00
|
|
|
click_button 'Mark todo as done'
|
2016-06-07 05:18:57 -04:00
|
|
|
end
|
|
|
|
|
2017-03-29 17:16:57 -04:00
|
|
|
expect(page).to have_selector('.todos-count', visible: false)
|
2016-06-17 04:01:03 -04:00
|
|
|
|
2017-07-06 12:20:50 -04:00
|
|
|
visit project_issue_path(project, issue)
|
2016-06-17 04:01:03 -04:00
|
|
|
|
2017-03-29 17:16:57 -04:00
|
|
|
expect(page).to have_selector('.todos-count', visible: false)
|
2016-06-07 05:18:57 -04:00
|
|
|
end
|
|
|
|
end
|