test/unit/subcommands_test.rb
# expected_command - name of command exepcted to have been run
# options:
#   - global_options => hash of expected options
#   - command_options => hash of expected command options
#   - args => array of expected args
name of command exepcted to have been run
options:
global_options => hash of expected options
command_options => hash of expected command options
args => array of expected args
name of command exepcted to have been run options : global_options = > hash of expected options command_options = > hash of expected command options args = > array of expected args
def assert_command_ran_with(expected_command,options)
    global_options = options[:global_options] || { :help => false }
    @run_results.each do |command,results|
      if command == expected_command
        assert_equal(indifferent_hash(global_options),results[0])
        assert_equal(indifferent_hash(options[:command_options]),results[1])
        assert_equal(options[:args],results[2])
      else
        assert_nil results
      end
    end
  end
def assert_command_ran_with ( expected_command , options ) global_options = options [ :global_options ] || { :help => false } @run_results . each do | command , results | if command == expected_command assert_equal ( indifferent_hash ( global_options ) , results [ 0 ] ) assert_equal ( indifferent_hash ( options [ :command_options ] ) , results [ 1 ] ) assert_equal ( options [ :args ] , results [ 2 ] ) else assert_nil results end end end
expected_command - name of command exepcted to have been run
options:
 global_options => hash of expected options
 command_options => hash of expected command options
 args => array of expected args
expected_command - name of command exepcted to have been run options : global_options = > hash of expected options command_options = > hash of expected command options args = > array of expected args
expected_command
options