summaryrefslogtreecommitdiff
path: root/spec/support/matchers/have_issuable_counts.rb
blob: 049cfc022fb0920864e514ece673e9da07797bf5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

RSpec::Matchers.define :have_issuable_counts do |opts|
  expected_counts = opts.map do |state, count|
    "#{state.to_s.humanize} #{count}"
  end

  match do |actual|
    actual.within '.issues-state-filters' do
      expected_counts.each do |expected_count|
        expect(actual).to have_content(expected_count)
      end
    end
  end

  description do
    "displays the following issuable counts: #{expected_counts.inspect}"
  end

  failure_message do
    "expected the following issuable counts: #{expected_counts.inspect} to be displayed"
  end
end