diff options
author | Stan Hu <stanhu@gmail.com> | 2016-06-15 01:01:43 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2016-06-15 01:01:43 +0300 |
commit | 5ac17fb2fa5b3f3ef8c4bed16f97d402858efe6f (patch) | |
tree | d85c6434cf2cb358356d41dbe7c9d869f03e7e31 /spec | |
parent | 06784ee782ff8a3212e1c6f1361fc43d36ae44e5 (diff) | |
parent | b22ba26caa233bc6cb56bc0b82f493713f657909 (diff) |
Merge branch 'manual-todos-issuable-sidebar' into 'master'
Manually create todo for issuable
## What does this MR do?
Adds a button to the sidebar in issues & merge requests to allow users to manually create a todo item themselves.
## What are the relevant issue numbers?
Closes #15045
## Screenshots (if relevant)
![Screen_Shot_2016-06-07_at_09.52.14](/uploads/00af70244c0589d19f241c3e85f3d63d/Screen_Shot_2016-06-07_at_09.52.14.png)
![Screen_Shot_2016-06-07_at_09.52.06](/uploads/e232b02208613a4a50cff4d1e6f119ff/Screen_Shot_2016-06-07_at_09.52.06.png)
![Screen_Shot_2016-06-07_at_09.51.14](/uploads/f1d36435d49ab882538ae2252bec8086/Screen_Shot_2016-06-07_at_09.51.14.png)
See merge request !4502
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/issues/todo_spec.rb | 33 | ||||
-rw-r--r-- | spec/services/todo_service_spec.rb | 16 |
2 files changed, 49 insertions, 0 deletions
diff --git a/spec/features/issues/todo_spec.rb b/spec/features/issues/todo_spec.rb new file mode 100644 index 00000000000..b69cce3e7d7 --- /dev/null +++ b/spec/features/issues/todo_spec.rb @@ -0,0 +1,33 @@ +require 'rails_helper' + +feature 'Manually create a todo item from issue', feature: true, js: true do + let!(:project) { create(:project) } + let!(:issue) { create(:issue, project: project) } + let!(:user) { create(:user)} + + before do + project.team << [user, :master] + login_as(user) + visit namespace_project_issue_path(project.namespace, project, issue) + end + + it 'should create todo when clicking button' do + page.within '.issuable-sidebar' do + click_button 'Add Todo' + expect(page).to have_content 'Mark Done' + end + + page.within '.header-content .todos-pending-count' do + expect(page).to have_content '1' + end + end + + it 'should mark a todo as done' do + page.within '.issuable-sidebar' do + click_button 'Add Todo' + click_button 'Mark Done' + end + + expect(page).to have_selector('.todos-pending-count', visible: false) + end +end diff --git a/spec/services/todo_service_spec.rb b/spec/services/todo_service_spec.rb index 549a936b060..26f09cdbaf9 100644 --- a/spec/services/todo_service_spec.rb +++ b/spec/services/todo_service_spec.rb @@ -228,6 +228,14 @@ describe TodoService, services: true do should_not_create_any_todo { service.new_note(note_on_project_snippet, john_doe) } end end + + describe '#mark_todo' do + it 'creates a todo from a issue' do + service.mark_todo(unassigned_issue, author) + + should_create_todo(user: author, target: unassigned_issue, action: Todo::MARKED) + end + end end describe 'Merge Requests' do @@ -361,6 +369,14 @@ describe TodoService, services: true do expect(second_todo.reload).not_to be_done end end + + describe '#mark_todo' do + it 'creates a todo from a merge request' do + service.mark_todo(mr_unassigned, author) + + should_create_todo(user: author, target: mr_unassigned, action: Todo::MARKED) + end + end end def should_create_todo(attributes = {}) |