Skip to content

Instantly share code, notes, and snippets.

@ainoya
Created July 28, 2016 06:52
Show Gist options
  • Save ainoya/b885a39ea03958a7663a62246ad0366e to your computer and use it in GitHub Desktop.
Save ainoya/b885a39ea03958a7663a62246ad0366e to your computer and use it in GitHub Desktop.
matcher for comparing string as uf8-mac coded string in test iOS app via appium
RSpec::Matchers.define :eq_as_utf8_mac do |expected|
match do |actual|
actual.force_encoding('UTF8-MAC') === expected.encode('UTF8-MAC')
end
end
expected = 'ぱぴぷぺぽ'
# actual = 'ぱぴぷぺぽ' gots from iOS App through appium server.
expect(find(actual).name.strip)
.to eq_as_utf8_mac(expected)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment