diff options
author | Jacopo <beschi.jacopo@gmail.com> | 2017-01-16 16:11:08 +0300 |
---|---|---|
committer | Jacopo <beschi.jacopo@gmail.com> | 2017-02-18 00:12:19 +0300 |
commit | 26160459b56019f445a7d29abc0b72f591e1d2a9 (patch) | |
tree | bf7150c7eda9436f001decae56407ca3b3f718f8 /spec/controllers | |
parent | 63330af84fb6ecdce4611af238af4233a436e260 (diff) |
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')
-rw-r--r-- | spec/controllers/dashboard/todos_controller_spec.rb | 25 |
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 |