diff options
author | Jacob Vosmaer <jacob@gitlab.com> | 2017-06-28 17:44:37 +0200 |
---|---|---|
committer | Jacob Vosmaer <jacob@gitlab.com> | 2017-06-30 14:32:42 +0200 |
commit | 8a62f304ef541b93ac47dab3b69b645f2b65537a (patch) | |
tree | 63c5f9f2f610962e0afc192fb45f307b8213aaae /spec/support | |
parent | 7648f113814a78ffde802172197ba2b0074ec753 (diff) | |
download | gitlab-ce-8a62f304ef541b93ac47dab3b69b645f2b65537a.tar.gz |
Add a UTF-8 encoding matcher
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/matchers/be_utf8.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/support/matchers/be_utf8.rb b/spec/support/matchers/be_utf8.rb new file mode 100644 index 00000000000..ea806352422 --- /dev/null +++ b/spec/support/matchers/be_utf8.rb @@ -0,0 +1,9 @@ +RSpec::Matchers.define :be_utf8 do |_| + match do |actual| + actual.is_a?(String) && actual.encoding == Encoding.find('UTF-8') + end + + description do + "be a String with encoding UTF-8" + end +end |