test/data_sources/test_filesystem.rb in nanoc-3.7.3 vs test/data_sources/test_filesystem.rb in nanoc-3.7.4

- old
+ new

@@ -84,13 +84,13 @@ File.open(filename, 'w') { |io| io.write('test') } end # Get all files output_expected = { - './foo' => [ 'yaml', 'html' ], - './bar.entry' => [ nil, 'html' ], - './foo/qux' => [ 'yaml', nil ] + './foo' => ['yaml', 'html'], + './bar.entry' => [nil, 'html'], + './foo/qux' => ['yaml', nil] } output_actual = data_source.send :all_split_files_in, '.' # Check assert_equal output_expected, output_actual @@ -111,13 +111,13 @@ File.open(filename, 'w') { |io| io.write('test') } end # Get all files output_expected = { - './foo' => [ 'yaml', 'html' ], - './bar' => [ nil, 'html.erb' ], - './foo/qux' => [ 'yaml', nil ] + './foo' => ['yaml', 'html'], + './bar' => [nil, 'html.erb'], + './foo/qux' => ['yaml', nil] } output_actual = data_source.send :all_split_files_in, '.' # Check assert_equal output_expected, output_actual @@ -133,13 +133,13 @@ File.open(filename, 'w') { |io| io.write('test') } end # Check expected = { - './aaa/foo' => [ nil, 'html' ], - './bbb/foo' => [ nil, 'html' ], - './ccc/foo' => [ nil, 'html' ] + './aaa/foo' => [nil, 'html'], + './bbb/foo' => [nil, 'html'], + './ccc/foo' => [nil, 'html'] } assert_equal expected, data_source.send(:all_split_files_in, '.') end def test_all_split_files_in_with_multiple_content_files @@ -289,11 +289,11 @@ data_source = Nanoc::DataSources::FilesystemCombined.new(nil, nil, nil, nil) # Parse it result = data_source.instance_eval { parse('test.html', nil, 'foobar') } assert_equal({ 'foo' => 'bar' }, result[0]) - assert_equal("", result[1]) + assert_equal('', result[1]) end def test_parse_embedded_meta_only_2 # Create a file File.open('test.html', 'w') do |io| @@ -306,28 +306,28 @@ data_source = Nanoc::DataSources::FilesystemCombined.new(nil, nil, nil, nil) # Parse it result = data_source.instance_eval { parse('test.html', nil, 'foobar') } assert_equal({ 'foo' => 'bar' }, result[0]) - assert_equal("", result[1]) + assert_equal('', result[1]) end def test_parse_embedded_meta_only_3 # Create a file File.open('test.html', 'w') do |io| io.write "-----\r\n" io.write "foo: bar\n" - io.write "-----" + io.write '-----' end # Create data source data_source = Nanoc::DataSources::FilesystemCombined.new(nil, nil, nil, nil) # Parse it result = data_source.instance_eval { parse('test.html', nil, 'foobar') } assert_equal({ 'foo' => 'bar' }, result[0]) - assert_equal("", result[1]) + assert_equal('', result[1]) end def test_parse_embedded_invalid_2 # Create a file File.open('test.html', 'w') do |io| @@ -401,11 +401,11 @@ # Create a file File.open('test.html', 'w') do |io| io.write "-----\n" io.write "-----\n" io.write "\nblah blah\n" - io.write "-----" + io.write '-----' end # Create data source data_source = Nanoc::DataSources::FilesystemCombined.new(nil, nil, nil, nil) @@ -415,11 +415,11 @@ assert_equal("\nblah blah\n-----", result[1]) end def test_parse_utf8_bom File.open('test.html', 'w') do |io| - io.write [ 0xEF, 0xBB, 0xBF ].map { |i| i.chr }.join + io.write [0xEF, 0xBB, 0xBF].map { |i| i.chr }.join io.write "-----\n" io.write "utf8bomawareness: high\n" io.write "-----\n" io.write "content goes here\n" end @@ -466,18 +466,18 @@ assert_equal(content, result[1]) end def test_parse_external # Create a file - File.open('test.html', 'w') { |io| io.write("blah blah") } - File.open('test.yaml', 'w') { |io| io.write("foo: bar") } + File.open('test.html', 'w') { |io| io.write('blah blah') } + File.open('test.yaml', 'w') { |io| io.write('foo: bar') } # Create data source data_source = Nanoc::DataSources::FilesystemCombined.new(nil, nil, nil, nil) # Parse it result = data_source.instance_eval { parse('test.html', 'test.yaml', 'foobar') } - assert_equal({ "foo" => "bar"}, result[0]) - assert_equal("blah blah", result[1]) + assert_equal({ 'foo' => 'bar'}, result[0]) + assert_equal('blah blah', result[1]) end end