test/cases/gigo_test.rb in gigo-1.2.0 vs test/cases/gigo_test.rb in gigo-1.3.0
- old
+ new
@@ -2,20 +2,31 @@
require 'test_helper'
module GIGO
class BaseTest < TestCase
- include ERB::Util
-
let(:data_utf8_emoji) { "💖" }
let(:data_utf8) { "€20 – “Woohoo”" }
let(:data_bad_readin) { "�20 � �Woohoo�" }
let(:data_cp1252) { data_utf8.encode('CP1252') }
let(:data_bin_apos) { "won\x92t".force_encoding('binary') }
let(:data_really_bad) { "ed.Ã\u0083Ã\u0083\xC3" }
+ describe '.encoding' do
+
+ it 'defaults to UTF-8 encoding' do
+ GIGO.encoding.must_equal Encoding::UTF_8
+ end
+
+ it 'can be set to any encoding' do
+ GIGO.encoding = Encoding::CP1252
+ GIGO.encoding.must_equal Encoding::CP1252
+ end
+
+ end
+
describe '.load' do
it 'ignores if string is not present' do
GIGO.load('').must_equal ''
GIGO.load(nil).must_be_nil
@@ -59,9 +70,19 @@
html_escape GIGO.load(data_really_bad)
end
end
-
+ describe '.transcoders' do
+
+ it 'is an array of default transcoders' do
+ GIGO.transcoders.must_equal [
+ GIGO::Transcoders::ActiveSupport,
+ GIGO::Transcoders::CharDet,
+ GIGO::Transcoders::Blind
+ ]
+ end
+
+ end
end
end