diff options
Diffstat (limited to 'test/csv/test_encodings.rb')
-rwxr-xr-x | test/csv/test_encodings.rb | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/test/csv/test_encodings.rb b/test/csv/test_encodings.rb index 54c34f3f38..5ff6d33821 100755 --- a/test/csv/test_encodings.rb +++ b/test/csv/test_encodings.rb @@ -80,15 +80,19 @@ class TestCSV::Encodings < TestCSV end def test_read_with_default_encoding - data = "abc" + data = "abc" default_external = Encoding.default_external each_encoding do |encoding| File.open(@temp_csv_path, "wb", encoding: encoding) {|f| f << data} begin - Encoding.default_external = encoding + no_warnings do + Encoding.default_external = encoding + end result = CSV.read(@temp_csv_path)[0][0] ensure - Encoding.default_external = default_external + no_warnings do + Encoding.default_external = default_external + end end assert_equal(encoding, result.encoding) end @@ -325,4 +329,11 @@ class TestCSV::Encodings < TestCSV yield encoding end end + + def no_warnings + old_verbose, $VERBOSE = $VERBOSE, nil + yield + ensure + $VERBOSE = old_verbose + end end |