Sha256: 021f514ffde9dbe0745f7ae4a8b8a32429053e568f6d282c9d9df5d1f9a4c1dc

Contents?: true

Size: 1.78 KB

Versions: 60

Compression:

Stored size: 1.78 KB

Contents

require 'helper'

module Nutella

  class TestCmdCLIParamsParsing < MiniTest::Test

    def setup
      @run_cmd = RunCommand.new
    end


    should 'parse app long argument' do
      params =  @run_cmd.parse_cli_parameters ['--with=bot1,bot2,bot3']
      assert_equal %w(bot1 bot2 bot3), params[:with]
    end

    should 'parse without long argument' do
      params =  @run_cmd.parse_cli_parameters ['--without=botA,botB,botC']
      assert_equal %w(botA botB botC), params[:without]
    end

    should 'parse with long argument' do
      params =  @run_cmd.parse_cli_parameters ['--with=botX,botY,botZ']
      assert_equal %w(botX botY botZ), params[:with]
    end

    should 'parse one short argument' do
      params =  @run_cmd.parse_cli_parameters ['-w=bot1,bot2,bot3']
      assert_equal %w(bot1 bot2 bot3), params[:with]
    end

    should 'parse two long arguments' do
      params =  @run_cmd.parse_cli_parameters %w(--with=bot1,bot2,bot3 --without=botA,botB,botC)
      assert_equal %w(bot1 bot2 bot3), params[:with]
      assert_equal %w(botA botB botC), params[:without]
    end

    should 'parse two short arguments' do
      params =  @run_cmd.parse_cli_parameters %w(-wo=bot1,bot2,bot3 -w=botA,botB,botC)
      assert_equal %w(bot1 bot2 bot3), params[:without]
      assert_equal %w(botA botB botC), params[:with]
    end

    should 'parse one short and one long argument' do
      params =  @run_cmd.parse_cli_parameters %w(--with=bot1,bot2,bot3 -wo=botA,botB,botC)
      assert_equal %w(bot1 bot2 bot3), params[:with]
      assert_equal %w(botA botB botC), params[:without]
    end

    should 'raise an exception when trying to parse params that do not exist' do
      assert_raises (StandardError) { @run_cmd.parse_cli_parameters %w(--wit=bot1,bot2,bot3 -o=botA,botB,botC) }
    end

  end

end

Version data entries

60 entries across 60 versions & 1 rubygems

Version Path
nutella_framework-0.9.2 test/commands/test_cmd_cli_params_parsing.rb
nutella_framework-0.9.1 test/commands/test_cmd_cli_params_parsing.rb
nutella_framework-0.9.0 test/commands/test_cmd_cli_params_parsing.rb
nutella_framework-0.8.0 test/commands/test_cmd_cli_params_parsing.rb
nutella_framework-0.7.3 test/commands/test_cmd_cli_params_parsing.rb
nutella_framework-0.7.2 test/commands/test_cmd_cli_params_parsing.rb
nutella_framework-0.7.1 test/commands/test_cmd_cli_params_parsing.rb
nutella_framework-0.7.0 test/commands/test_cmd_cli_params_parsing.rb
nutella_framework-0.6.21 test/commands/test_cmd_cli_params_parsing.rb
nutella_framework-0.6.20 test/commands/test_cmd_cli_params_parsing.rb
nutella_framework-0.6.19 test/commands/test_cmd_cli_params_parsing.rb
nutella_framework-0.6.18 test/commands/test_cmd_cli_params_parsing.rb
nutella_framework-0.6.17 test/commands/test_cmd_cli_params_parsing.rb
nutella_framework-0.6.16 test/commands/test_cmd_cli_params_parsing.rb
nutella_framework-0.6.15 test/commands/test_cmd_cli_params_parsing.rb
nutella_framework-0.6.13 test/commands/test_cmd_cli_params_parsing.rb
nutella_framework-0.6.12 test/commands/test_cmd_cli_params_parsing.rb
nutella_framework-0.6.11 test/commands/test_cmd_cli_params_parsing.rb
nutella_framework-0.6.10 test/commands/test_cmd_cli_params_parsing.rb
nutella_framework-0.6.9 test/commands/test_cmd_cli_params_parsing.rb