summaryrefslogtreecommitdiff
path: root/spec/support/matchers
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-09-29 16:55:55 +0200
committerRémy Coutable <remy@rymai.me>2016-09-30 12:02:54 +0200
commit56259155d5a0ecfbbafb7319651495582504cfb8 (patch)
tree311bc67de01c68e896d0a608c3c9fdbc85d77b9d /spec/support/matchers
parent383dafdf31adaded392664cba9ba8b7262505dc6 (diff)
downloadgitlab-ce-56259155d5a0ecfbbafb7319651495582504cfb8.tar.gz
Small improvements thanks to Robert's feedback
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/support/matchers')
-rw-r--r--spec/support/matchers/have_issuable_counts.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/support/matchers/have_issuable_counts.rb b/spec/support/matchers/have_issuable_counts.rb
new file mode 100644
index 00000000000..02605d6b70e
--- /dev/null
+++ b/spec/support/matchers/have_issuable_counts.rb
@@ -0,0 +1,21 @@
+RSpec::Matchers.define :have_issuable_counts do |opts|
+ match do |actual|
+ expected_counts = opts.map do |state, count|
+ "#{state.to_s.humanize} #{count}"
+ end
+
+ 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