test/cli/test_cli.rb in nanoc-4.7.5 vs test/cli/test_cli.rb in nanoc-4.7.6

- old
+ new

@@ -20,20 +20,20 @@ File.open('_test_sub.out', 'w') { |io| io.write('It works sub!') } end EOS def test_load_custom_commands - Nanoc::CLI.run %w(create_site foo) + Nanoc::CLI.run %w[create_site foo] FileUtils.cd('foo') do # Create command FileUtils.mkdir_p('commands') File.open('commands/_test.rb', 'w') { |io| io.write(COMMAND_CODE) } # Run command begin - Nanoc::CLI.run %w(_test) + Nanoc::CLI.run %w[_test] rescue SystemExit assert false, 'Running _test should not cause system exit' end # Check @@ -41,11 +41,11 @@ assert_equal 'It works!', File.read('_test.out') end end def test_load_custom_commands_nested - Nanoc::CLI.run %w(create_site foo) + Nanoc::CLI.run %w[create_site foo] FileUtils.cd('foo') do # Create command FileUtils.mkdir_p('commands') File.open('commands/_test.rb', 'w') do |io| io.write(COMMAND_CODE) @@ -57,11 +57,11 @@ io.write(SUBCOMMAND_CODE) end # Run command begin - Nanoc::CLI.run %w(_test _sub) + Nanoc::CLI.run %w[_test _sub] rescue SystemExit assert false, 'Running _test sub should not cause system exit' end # Check @@ -69,11 +69,11 @@ assert_equal 'It works sub!', File.read('_test_sub.out') end end def test_load_custom_commands_non_default_commands_dirs - Nanoc::CLI.run %w(create_site foo) + Nanoc::CLI.run %w[create_site foo] FileUtils.cd('foo') do File.open('nanoc.yaml', 'w') { |io| io.write('commands_dirs: [commands, commands_alt]') } # Create command FileUtils.mkdir_p('commands_alt') @@ -87,11 +87,11 @@ io.write(SUBCOMMAND_CODE) end # Run command begin - Nanoc::CLI.run %w(_test _sub) + Nanoc::CLI.run %w[_test _sub] rescue SystemExit assert false, 'Running _test sub should not cause system exit' end # Check @@ -99,25 +99,25 @@ assert_equal 'It works sub!', File.read('_test_sub.out') end end def test_load_custom_commands_broken - Nanoc::CLI.run %w(create_site foo) + Nanoc::CLI.run %w[create_site foo] FileUtils.cd('foo') do # Create command FileUtils.mkdir_p('commands') File.open('commands/_test.rb', 'w') { |io| io.write('raise "meh"') } # Run command position_before = $stderr.tell Nanoc::CLI::ErrorHandler.disable assert_raises RuntimeError do - Nanoc::CLI.run %w(_test) + Nanoc::CLI.run %w[_test] end Nanoc::CLI::ErrorHandler.enable assert_raises SystemExit do - Nanoc::CLI.run %w(_test) + Nanoc::CLI.run %w[_test] end position_after = $stderr.tell # Check error output stderr_addition = $stderr.string[position_before, position_after]