Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-03 21:06:49 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-03 21:06:49 +0300
commitab7cf450ba19cf80b9534f25dc707b33845e3014 (patch)
treebbfa6aba83c48aea68d79c4179ce576b6eec326d /spec/services/todo_service_spec.rb
parent4204cf308596e0e26f578a6e2da88f49c0f4aad9 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services/todo_service_spec.rb')
-rw-r--r--spec/services/todo_service_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/services/todo_service_spec.rb b/spec/services/todo_service_spec.rb
index 818794ed956..0d7e17ad52c 100644
--- a/spec/services/todo_service_spec.rb
+++ b/spec/services/todo_service_spec.rb
@@ -1015,6 +1015,30 @@ describe TodoService do
end
end
+ describe '#mark_todo_as_done' do
+ it 'marks a todo done' do
+ todo1 = create(:todo, :pending, user: john_doe)
+
+ described_class.new.mark_todo_as_done(todo1, john_doe)
+
+ expect(todo1.reload.state).to eq('done')
+ end
+
+ context 'when todo is already in state done' do
+ let(:todo1) { create(:todo, :done, user: john_doe) }
+
+ it 'does not update the todo' do
+ expect { described_class.new.mark_todo_as_done(todo1, john_doe) }.not_to change(todo1.reload, :state)
+ end
+
+ it 'does not update cache count' do
+ expect(john_doe).not_to receive(:update_todos_count_cache)
+
+ described_class.new.mark_todo_as_done(todo1, john_doe)
+ end
+ end
+ end
+
describe '#mark_all_todos_as_done_by_user' do
it 'marks all todos done' do
todo1 = create(:todo, user: john_doe, state: :pending)