diff options
Diffstat (limited to 'test/csv/helper.rb')
-rw-r--r-- | test/csv/helper.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/csv/helper.rb b/test/csv/helper.rb index eadff54408..1f9cf96979 100644 --- a/test/csv/helper.rb +++ b/test/csv/helper.rb @@ -15,4 +15,28 @@ module Helper ENV["CSV_PARSER_SCANNER_TEST_CHUNK_SIZE"] = chunk_size_keep end end + + def with_verbose(verbose) + original = $VERBOSE + begin + $VERBOSE = verbose + yield + ensure + $VERBOSE = original + end + end + + def with_default_internal(encoding) + original = Encoding.default_internal + begin + with_verbose(false) do + Encoding.default_internal = encoding + end + yield + ensure + with_verbose(false) do + Encoding.default_internal = original + end + end + end end |