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.4.23 test/commands/test_cmd_cli_params_parsing.rb
nutella_framework-0.4.22 test/commands/test_cmd_cli_params_parsing.rb
nutella_framework-0.4.21 test/commands/test_cmd_cli_params_parsing.rb
nutella_framework-0.4.20 test/commands/test_cmd_cli_params_parsing.rb
nutella_framework-0.4.19 test/commands/test_cmd_cli_params_parsing.rb
nutella_framework-0.4.18 test/commands/test_cmd_cli_params_parsing.rb
nutella_framework-0.4.17 test/commands/test_cmd_cli_params_parsing.rb
nutella_framework-0.4.16 test/commands/test_cmd_cli_params_parsing.rb
nutella_framework-0.4.13 test/commands/test_cmd_cli_params_parsing.rb
nutella_framework-0.4.12 test/commands/test_cmd_cli_params_parsing.rb
nutella_framework-0.4.11 test/commands/test_cmd_cli_params_parsing.rb
nutella_framework-0.4.10 test/commands/test_cmd_cli_params_parsing.rb
nutella_framework-0.4.9 test/commands/test_cmd_cli_params_parsing.rb
nutella_framework-0.4.8 test/commands/test_cmd_cli_params_parsing.rb
nutella_framework-0.4.5 test/commands/test_cmd_cli_params_parsing.rb
nutella_framework-0.4.4 test/commands/test_cmd_cli_params_parsing.rb
nutella_framework-0.4.3 test/commands/test_cmd_cli_params_parsing.rb
nutella_framework-0.4.2 test/commands/test_cmd_cli_params_parsing.rb
nutella_framework-0.4.1 test/commands/test_cmd_cli_params_parsing.rb
nutella_framework-0.4.0 test/commands/test_cmd_cli_params_parsing.rb