2019-07-25 01:27:42 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-09-29 10:55:55 -04:00
|
|
|
RSpec::Matchers.define :have_issuable_counts do |opts|
|
2016-11-28 11:48:10 -05:00
|
|
|
expected_counts = opts.map do |state, count|
|
|
|
|
"#{state.to_s.humanize} #{count}"
|
|
|
|
end
|
2016-09-29 10:55:55 -04:00
|
|
|
|
2016-11-28 11:48:10 -05:00
|
|
|
match do |actual|
|
2016-09-29 10:55:55 -04:00
|
|
|
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
|