2016-06-07 05:18:57 -04:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2017-06-29 00:13:10 -04:00
|
|
|
feature 'Manually create a todo item from issue', js: true 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
|
|
|
|
project.team << [user, :master]
|
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'
|
|
|
|
expect(page).to have_content 'Mark 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'
|
|
|
|
click_button 'Mark 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
|