Sha256: ad6c07258b7eefb36fce566368b0a4149d60cf37f4f48a7c55b998c399a9ee6f
Contents?: true
Size: 1.9 KB
Versions: 2
Compression:
Stored size: 1.9 KB
Contents
require 'helper' module Nutella class TestRunCommand < MiniTest::Test @@run_cmd = RunCommand.new should 'parse app long argument' do params = @@run_cmd.send( :extract_parameters, ['--with=bot1,bot2,bot3'] ) assert_equal ['bot1', 'bot2', 'bot3'], params[:with] end should 'parse without long argument' do params = @@run_cmd.send( :extract_parameters, ['--without=botA,botB,botC'] ) assert_equal ['botA', 'botB', 'botC'], params[:without] end should 'parse with long argument' do params = @@run_cmd.send( :extract_parameters, ['--with=botX,botY,botZ'] ) assert_equal ['botX', 'botY', 'botZ'], params[:with] end should 'parse one short argument' do params = @@run_cmd.send( :extract_parameters, ['-w=bot1,bot2,bot3'] ) assert_equal ['bot1', 'bot2', 'bot3'], params[:with] end should 'parse two long arguments' do params = @@run_cmd.send( :extract_parameters, ['--with=bot1,bot2,bot3', '--without=botA,botB,botC'] ) assert_equal ['bot1', 'bot2', 'bot3'], params[:with] assert_equal ['botA', 'botB', 'botC'], params[:without] end should 'parse two short arguments' do params = @@run_cmd.send( :extract_parameters, ['-wo=bot1,bot2,bot3', '-w=botA,botB,botC'] ) assert_equal ['bot1', 'bot2', 'bot3'], params[:without] assert_equal ['botA', 'botB', 'botC'], params[:with] end should 'parse one short and one long argument' do params = @@run_cmd.send( :extract_parameters, ['--with=bot1,bot2,bot3', '-wo=botA,botB,botC'] ) assert_equal ['bot1', 'bot2', 'bot3'], params[:with] assert_equal ['botA', 'botB', 'botC'], params[:without] end should 'raise an exception when trying to parse params that do not exist' do assert_raises (Slop::UnknownOption) { @@run_cmd.send( :extract_parameters, ['--wit=bot1,bot2,bot3', '-o=botA,botB,botC'] ) } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nutella_framework-0.3.1 | test/test_run_command.rb |
nutella_framework-0.3.0 | test/test_run_command.rb |