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:
authorClement Ho <ClemMakesApps@gmail.com>2016-08-27 20:36:08 +0300
committerClement Ho <ClemMakesApps@gmail.com>2016-08-29 18:46:36 +0300
commit2b33b24a3a5174cb391bf6c93643838f743e3dd2 (patch)
tree5fb85fefada7c1a29a8a254470be8f3700ff2a27 /spec/support/taskable_shared_examples.rb
parentc288916db124f1a0aaf5fe3eff53335f23d11921 (diff)
Shorten task status phrase
Diffstat (limited to 'spec/support/taskable_shared_examples.rb')
-rw-r--r--spec/support/taskable_shared_examples.rb63
1 files changed, 45 insertions, 18 deletions
diff --git a/spec/support/taskable_shared_examples.rb b/spec/support/taskable_shared_examples.rb
index 927c72c7409..201614e45a4 100644
--- a/spec/support/taskable_shared_examples.rb
+++ b/spec/support/taskable_shared_examples.rb
@@ -3,30 +3,57 @@
# Requires a context containing:
# subject { Issue or MergeRequest }
shared_examples 'a Taskable' do
- before do
- subject.description = <<-EOT.strip_heredoc
- * [ ] Task 1
- * [x] Task 2
- * [x] Task 3
- * [ ] Task 4
- * [ ] Task 5
- EOT
+ describe 'with multiple tasks' do
+ before do
+ subject.description = <<-EOT.strip_heredoc
+ * [ ] Task 1
+ * [x] Task 2
+ * [x] Task 3
+ * [ ] Task 4
+ * [ ] Task 5
+ EOT
+ end
+
+ it 'returns the correct task status' do
+ expect(subject.task_status).to match('2 of')
+ expect(subject.task_status).to match('5 tasks completed')
+ end
+
+ describe '#tasks?' do
+ it 'returns true when object has tasks' do
+ expect(subject.tasks?).to eq true
+ end
+
+ it 'returns false when object has no tasks' do
+ subject.description = 'Now I have no tasks'
+ expect(subject.tasks?).to eq false
+ end
+ end
end
- it 'returns the correct task status' do
- expect(subject.task_status).to match('5 tasks')
- expect(subject.task_status).to match('2 completed')
- expect(subject.task_status).to match('3 remaining')
+ describe 'with an incomplete task' do
+ before do
+ subject.description = <<-EOT.strip_heredoc
+ * [ ] Task 1
+ EOT
+ end
+
+ it 'returns the correct task status' do
+ expect(subject.task_status).to match('0 of')
+ expect(subject.task_status).to match('1 task completed')
+ end
end
- describe '#tasks?' do
- it 'returns true when object has tasks' do
- expect(subject.tasks?).to eq true
+ describe 'with a complete task' do
+ before do
+ subject.description = <<-EOT.strip_heredoc
+ * [x] Task 1
+ EOT
end
- it 'returns false when object has no tasks' do
- subject.description = 'Now I have no tasks'
- expect(subject.tasks?).to eq false
+ it 'returns the correct task status' do
+ expect(subject.task_status).to match('1 of')
+ expect(subject.task_status).to match('1 task completed')
end
end
end