2016-06-16 23:09:34 +05:30
|
|
|
require 'rails_helper'
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
describe 'Manually create a todo item from issue', :js do
|
2017-09-10 17:25:29 +05:30
|
|
|
let!(:project) { create(:project) }
|
|
|
|
let!(:issue) { create(:issue, project: project) }
|
|
|
|
let!(:user) { create(:user)}
|
2016-06-16 23:09:34 +05:30
|
|
|
|
|
|
|
before do
|
2018-11-18 11:00:15 +05:30
|
|
|
project.add_maintainer(user)
|
2017-09-10 17:25:29 +05:30
|
|
|
sign_in(user)
|
|
|
|
visit project_issue_path(project, issue)
|
2016-06-16 23:09:34 +05:30
|
|
|
end
|
|
|
|
|
2016-09-13 17:45:13 +05:30
|
|
|
it 'creates todo when clicking button' do
|
2016-06-16 23:09:34 +05:30
|
|
|
page.within '.issuable-sidebar' do
|
2017-08-17 22:00:37 +05:30
|
|
|
click_button 'Add todo'
|
2018-10-15 14:42:47 +05:30
|
|
|
expect(page).to have_content 'Mark todo as done'
|
2016-06-16 23:09:34 +05:30
|
|
|
end
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
page.within '.header-content .todos-count' do
|
2016-06-16 23:09:34 +05:30
|
|
|
expect(page).to have_content '1'
|
|
|
|
end
|
2016-06-22 15:30:34 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
visit project_issue_path(project, issue)
|
2016-06-22 15:30:34 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
page.within '.header-content .todos-count' do
|
2016-06-22 15:30:34 +05:30
|
|
|
expect(page).to have_content '1'
|
|
|
|
end
|
2016-06-16 23:09:34 +05:30
|
|
|
end
|
|
|
|
|
2016-09-13 17:45:13 +05:30
|
|
|
it 'marks a todo as done' do
|
2016-06-16 23:09:34 +05:30
|
|
|
page.within '.issuable-sidebar' do
|
2017-08-17 22:00:37 +05:30
|
|
|
click_button 'Add todo'
|
2018-10-15 14:42:47 +05:30
|
|
|
click_button 'Mark todo as done'
|
2016-06-16 23:09:34 +05:30
|
|
|
end
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(page).to have_selector('.todos-count', visible: false)
|
2016-06-22 15:30:34 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
visit project_issue_path(project, issue)
|
2016-06-22 15:30:34 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(page).to have_selector('.todos-count', visible: false)
|
2016-06-16 23:09:34 +05:30
|
|
|
end
|
|
|
|
end
|