diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-18 17:02:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-18 17:02:45 +0300 |
commit | 80f61b4035607d7cd87de993b8f5e996bde3481f (patch) | |
tree | 06b12f51e97d87192e3dd0e05edf55143645b894 /spec/models/todo_spec.rb | |
parent | 4ab54c2233e91f60a80e5b6fa2181e6899fdcc3e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/todo_spec.rb')
-rw-r--r-- | spec/models/todo_spec.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/models/todo_spec.rb b/spec/models/todo_spec.rb index ce17704acbd..c2566ccd047 100644 --- a/spec/models/todo_spec.rb +++ b/spec/models/todo_spec.rb @@ -273,6 +273,22 @@ describe Todo do expect(described_class.any_for_target?(todo.target)).to eq(true) end + it 'returns true if there is at least one todo for a given target with state pending' do + issue = create(:issue) + create(:todo, state: :done, target: issue) + create(:todo, state: :pending, target: issue) + + expect(described_class.any_for_target?(issue)).to eq(true) + end + + it 'returns false if there are only todos for a given target with state done while searching for pending' do + issue = create(:issue) + create(:todo, state: :done, target: issue) + create(:todo, state: :done, target: issue) + + expect(described_class.any_for_target?(issue, :pending)).to eq(false) + end + it 'returns false if there are no todos for a given target' do issue = create(:issue) |