2014-10-05 22:17:28 -04:00
|
|
|
# Specs for task state functionality for issues and merge requests.
|
|
|
|
#
|
|
|
|
# Requires a context containing:
|
2015-04-16 16:25:25 -04:00
|
|
|
# subject { Issue or MergeRequest }
|
2014-10-05 22:17:28 -04:00
|
|
|
shared_examples 'a Taskable' do
|
|
|
|
before do
|
2015-04-29 17:47:55 -04:00
|
|
|
subject.description = <<-EOT.strip_heredoc
|
2014-10-05 22:17:28 -04:00
|
|
|
* [ ] Task 1
|
|
|
|
* [x] Task 2
|
|
|
|
* [x] Task 3
|
|
|
|
* [ ] Task 4
|
|
|
|
* [ ] Task 5
|
2015-04-29 17:47:55 -04:00
|
|
|
EOT
|
2014-10-05 22:17:28 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'returns the correct task status' do
|
|
|
|
expect(subject.task_status).to match('5 tasks')
|
2015-05-06 17:27:10 -04:00
|
|
|
expect(subject.task_status).to match('2 completed')
|
|
|
|
expect(subject.task_status).to match('3 remaining')
|
2014-10-05 22:17:28 -04:00
|
|
|
end
|
|
|
|
|
2015-04-29 17:47:55 -04:00
|
|
|
describe '#tasks?' do
|
|
|
|
it 'returns true when object has tasks' do
|
|
|
|
expect(subject.tasks?).to eq true
|
|
|
|
end
|
2014-10-05 22:17:28 -04:00
|
|
|
|
2015-04-29 17:47:55 -04:00
|
|
|
it 'returns false when object has no tasks' do
|
|
|
|
subject.description = 'Now I have no tasks'
|
|
|
|
expect(subject.tasks?).to eq false
|
|
|
|
end
|
2014-10-05 22:17:28 -04:00
|
|
|
end
|
|
|
|
end
|