test/cli/test_cli.rb in nanoc-4.2.1 vs test/cli/test_cli.rb in nanoc-4.2.2

- old
+ new

@@ -18,20 +18,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 @@ -39,11 +39,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) @@ -55,11 +55,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 @@ -67,11 +67,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') @@ -85,11 +85,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 @@ -97,25 +97,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]