summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-03-16 10:56:39 +0100
committerRémy Coutable <remy@rymai.me>2017-03-17 12:20:54 +0100
commit517598ba10793efa02cb90379f78ab97c9c5b25d (patch)
tree92c5a186aa1dd8104a9bd2fe5412ffc0e0e8292b /spec/support
parentf016da6207502c090f24fc5e79b6b89d9aa9b4b0 (diff)
downloadgitlab-ce-517598ba10793efa02cb90379f78ab97c9c5b25d.tar.gz
Add a new have_html_escaped_body_text that match an HTML-escaped text20121-add-a-new-have_html_escaped_body_text-matcher
This solves transient failures when a text contains HTML-escapable characters such as `'`. Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/matchers/email_matchers.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/spec/support/matchers/email_matchers.rb b/spec/support/matchers/email_matchers.rb
new file mode 100644
index 00000000000..d9d59ec12ec
--- /dev/null
+++ b/spec/support/matchers/email_matchers.rb
@@ -0,0 +1,5 @@
+RSpec::Matchers.define :have_html_escaped_body_text do |expected|
+ match do |actual|
+ expect(actual).to have_body_text(ERB::Util.html_escape(expected))
+ end
+end