test/test_optionparser.rb in deblank-0.1.0 vs test/test_optionparser.rb in deblank-0.2.0
- old
+ new
@@ -1,48 +1,43 @@
-# encoding: UTF-8
-#
-# test_optionparser.rb: Unit tests for the deblank script.
-#
-# Copyright (C) 2012-2013 Marcus Stollsteimer
+# frozen_string_literal: true
-require 'minitest/spec'
-require 'minitest/autorun'
-require 'deblank'
+require "minitest/autorun"
+require "deblank"
describe Deblank::Optionparser do
before do
@parser = Deblank::Optionparser
@arg = "test_รค.txt"
- @arg_Win_1252_labeled_as_CP850 = "test_\xE4.txt".force_encoding('CP850')
- @arg_Win_1252 = "test_\xE4.txt".force_encoding('Windows-1252')
+ @arg_win1252_labeled_as_cp850 = (+"test_\xE4.txt").force_encoding("CP850")
+ @arg_win1252 = (+"test_\xE4.txt").force_encoding("Windows-1252")
end
- it 'can correct encoding from (seemingly) CP850 to Windows-1252' do
- arg = @arg_Win_1252_labeled_as_CP850
- arg.encoding.must_equal Encoding::CP850
+ it "can correct encoding from (seemingly) CP850 to Windows-1252" do
+ arg = @arg_win1252_labeled_as_cp850
+ _(arg.encoding).must_equal Encoding::CP850
corrected_arg = @parser.correct_encoding(arg)
- corrected_arg.encoding.must_equal Encoding::Windows_1252
+ _(corrected_arg.encoding).must_equal Encoding::Windows_1252
end
- it 'encodes (seemingly) CP850 encoded filenames into UTF-8' do
- options = @parser.parse!([@arg_Win_1252_labeled_as_CP850])
+ it "encodes (seemingly) CP850 encoded filenames into UTF-8" do
+ options = @parser.parse!([@arg_win1252_labeled_as_cp850])
filename = options[:files].first
- filename.encoding.must_equal Encoding::UTF_8
- filename.must_equal @arg
+ _(filename.encoding).must_equal Encoding::UTF_8
+ _(filename).must_equal @arg
end
- it 'encodes Windows-1252 encoded filenames into UTF-8' do
- options = @parser.parse!([@arg_Win_1252])
+ it "encodes Windows-1252 encoded filenames into UTF-8" do
+ options = @parser.parse!([@arg_win1252])
filename = options[:files].first
- filename.encoding.must_equal Encoding::UTF_8
- filename.must_equal @arg
+ _(filename.encoding).must_equal Encoding::UTF_8
+ _(filename).must_equal @arg
end
- it 'encodes UTF-8 encoded filenames into UTF-8' do
+ it "encodes UTF-8 encoded filenames into UTF-8" do
options = @parser.parse!([@arg])
filename = options[:files].first
- filename.encoding.must_equal Encoding::UTF_8
- filename.must_equal @arg
+ _(filename.encoding).must_equal Encoding::UTF_8
+ _(filename).must_equal @arg
end
end