Sha256: 4a9b5cf1cbc3f961a4d29e0fefbb99082cfbf6a35568d25f15923de758e96d1b
Contents?: true
Size: 992 Bytes
Versions: 34
Compression:
Stored size: 992 Bytes
Contents
# encoding: UTF-8 # 100% shorthand module CodepointTestHelper def assert_equal_encoded(expected, encode_mes) # Killing a duck because Ruby 1.9 doesn't mix Enumerable into String encode_mes = [encode_mes] if encode_mes.is_a?(String) encode_mes.each do |encode_me| encoded = encode(encode_me) actual = encoded.to_ascii if expected == actual # Let's not retest it assert true else message = "<#{expected.inspect}> expected but was\n<#{actual.inspect}>\n" message << " defined in #{Stringex::Unidecoder.in_yaml_file(encoded)}" reporting_class = defined?(Test::Unit::AssertionFailedError) ? Test::Unit::AssertionFailedError : ActiveSupport::TestCase::Assertion raise reporting_class.new(message) end end end private def encode(codepoint) Stringex::Unidecoder.encode(codepoint) end def which_yaml(codepoint) Stringex::Unidecoder.in_yaml_file(encode(codepoint)) end end
Version data entries
34 entries across 34 versions & 1 rubygems