Class: CommandProcessorTest
- Defined in:
- lib/argument_processor.rb
Instance Method Summary collapse
- #setup ⇒ Object
- #test_process_commands_with_search ⇒ Object
- #test_process_commands_with_valid_file ⇒ Object
Instance Method Details
#setup ⇒ Object
112 113 114 115 116 117 118 119 120 121 |
# File 'lib/argument_processor.rb', line 112 def setup @exisiting_file_name = Dir.glob('fixtures/*').first @missing_file_name = 'missing-file.tmp' @arguments = [@exisiting_file_name, 'process', '--option', 'value', 'ignored'] @named_procs = [] @options_parsed = [{ name: '--option', procname: 'VAL', value: 'value' }] @rest = [@exisiting_file_name, 'process', 'ignored'] @enable_search = true end |
#test_process_commands_with_search ⇒ Object
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/argument_processor.rb', line 143 def test_process_commands_with_search result = [] process_commands(arguments: [@missing_file_name, 'process'], named_procs: @named_procs, options_parsed: [], rest: [@missing_file_name, 'process'], enable_search: @enable_search) do |type, item| result << [type, item] end expected = [ [ArgPro::ActFind, @missing_file_name], [ArgPro::ActSetBlockName, 'process'] ] assert_equal expected, result end |
#test_process_commands_with_valid_file ⇒ Object
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/argument_processor.rb', line 123 def test_process_commands_with_valid_file result = [] process_commands( arguments: @arguments, named_procs: @named_procs, options_parsed: @options_parsed, rest: @rest, enable_search: @enable_search ) do |type, item| result << [type, item] end expected = [ [ArgPro::ActSetFileName, @exisiting_file_name], [ArgPro::ActSetBlockName, 'process'], [ArgPro::ActSetOption, ['--option', 'value']], [ArgPro::ActSetBlockName, 'ignored'] ] assert_equal expected, result end |