2015-04-26 12:48:37 +05:30
|
|
|
# Specs for task state functionality for issues and merge requests.
|
|
|
|
#
|
|
|
|
# Requires a context containing:
|
2015-09-11 14:41:01 +05:30
|
|
|
# subject { Issue or MergeRequest }
|
2015-04-26 12:48:37 +05:30
|
|
|
shared_examples 'a Taskable' do
|
|
|
|
before do
|
2015-09-11 14:41:01 +05:30
|
|
|
subject.description = <<-EOT.strip_heredoc
|
2015-04-26 12:48:37 +05:30
|
|
|
* [ ] Task 1
|
|
|
|
* [x] Task 2
|
|
|
|
* [x] Task 3
|
|
|
|
* [ ] Task 4
|
|
|
|
* [ ] Task 5
|
2015-09-11 14:41:01 +05:30
|
|
|
EOT
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'returns the correct task status' do
|
|
|
|
expect(subject.task_status).to match('5 tasks')
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(subject.task_status).to match('2 completed')
|
|
|
|
expect(subject.task_status).to match('3 remaining')
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
2015-09-11 14:41:01 +05:30
|
|
|
describe '#tasks?' do
|
|
|
|
it 'returns true when object has tasks' do
|
|
|
|
expect(subject.tasks?).to eq true
|
|
|
|
end
|
2015-04-26 12:48:37 +05:30
|
|
|
|
2015-09-11 14:41:01 +05:30
|
|
|
it 'returns false when object has no tasks' do
|
|
|
|
subject.description = 'Now I have no tasks'
|
|
|
|
expect(subject.tasks?).to eq false
|
|
|
|
end
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
end
|