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

taskable_shared_examples.rb « support « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 927c72c74098f000ea1cd0be098009ba79da13f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Specs for task state functionality for issues and merge requests.
#
# 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
  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')
  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