summaryrefslogtreecommitdiff
path: root/spec/support/matchers/be_utf8.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/matchers/be_utf8.rb')
-rw-r--r--spec/support/matchers/be_utf8.rb9
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