Skip to content

Instantly share code, notes, and snippets.

@dominikh
Created April 22, 2012 15:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dominikh/2ce65458a7d39e62ac82 to your computer and use it in GitHub Desktop.
Save dominikh/2ce65458a7d39e62ac82 to your computer and use it in GitHub Desktop.
# encoding: utf-8
Encoding.default_internal = "ISO-8859-1"
require "minitest/autorun"
class EncodingTest < MiniTest::Unit::TestCase
def setup
@s = "äöü"
end
def test_encoding
assert_equal Encoding::UTF_8, @s.encoding
end
def test_encode_bang_no_arguments
@s.encode!
assert_equal Encoding::ISO_8859_1, @s.encoding
end
def test_encode_bang_only_hash
@s.encode!({:invalid => :replace, :undef => :replace})
assert_equal Encoding::ISO_8859_1, @s.encoding
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment