summaryrefslogtreecommitdiff
path: root/spec/controllers/dashboard
diff options
context:
space:
mode:
authorJacopo <beschi.jacopo@gmail.com>2017-01-16 14:11:08 +0100
committerJacopo <beschi.jacopo@gmail.com>2017-02-17 22:12:19 +0100
commit26160459b56019f445a7d29abc0b72f591e1d2a9 (patch)
treebf7150c7eda9436f001decae56407ca3b3f718f8 /spec/controllers/dashboard
parent63330af84fb6ecdce4611af238af4233a436e260 (diff)
downloadgitlab-ce-26160459b56019f445a7d29abc0b72f591e1d2a9.tar.gz
Todo done clicking is kind of unusable.
The Done button will change to an Undo button and the line item will be greyed out. Bold links will be unbolded. The user can undo the task by clicking the Undo button.
Diffstat (limited to 'spec/controllers/dashboard')
-rw-r--r--spec/controllers/dashboard/todos_controller_spec.rb25
1 files changed, 20 insertions, 5 deletions
diff --git a/spec/controllers/dashboard/todos_controller_spec.rb b/spec/controllers/dashboard/todos_controller_spec.rb
index 79ef3a1adad..0a3ac9f9512 100644
--- a/spec/controllers/dashboard/todos_controller_spec.rb
+++ b/spec/controllers/dashboard/todos_controller_spec.rb
@@ -1,16 +1,19 @@
require 'spec_helper'
describe Dashboard::TodosController do
+ include ApiHelpers
+
let(:user) { create(:user) }
+ let(:author) { create(:user) }
let(:project) { create(:empty_project) }
let(:todo_service) { TodoService.new }
- describe 'GET #index' do
- before do
- sign_in(user)
- project.team << [user, :developer]
- end
+ before do
+ sign_in(user)
+ project.team << [user, :developer]
+ end
+ describe 'GET #index' do
context 'when using pagination' do
let(:last_page) { user.todos.page.total_pages }
let!(:issues) { create_list(:issue, 2, project: project, assignee: user) }
@@ -34,4 +37,16 @@ describe Dashboard::TodosController do
end
end
end
+
+ describe 'PATCH #restore' do
+ let(:todo) { create(:todo, :done, user: user, project: project, author: author) }
+
+ it 'restores the todo to pending state' do
+ patch :restore, id: todo.id
+
+ expect(todo.reload).to be_pending
+ expect(response).to have_http_status(200)
+ expect(json_response).to eq({ "count" => 1, "done_count" => 0 })
+ end
+ end
end