Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix bug for a Runner command that doesn't have required args - #34

  • Loading branch information...
commit 5d261374b9503e41006e93300b9eecc747ec7637 1 parent 4234e70
@cldwalker authored
Showing with 9 additions and 2 deletions.
  1. +2 −2 lib/boson/command.rb
  2. +7 −0 test/runner_test.rb
View
4 lib/boson/command.rb
@@ -144,8 +144,8 @@ def numerical_arg_size?
# Determines if incorrect # of args given i.e. too little or too much
def incorrect_arg_size?(args)
return false if has_splat_args?
- required_arg_size = args.take_while {|e| e[1].nil? }.size
- args.size < required_arg_size || args.size > arg_size
+ required_arg_size = @args.take_while {|e| e[1].nil? }.size
+ args.size < required_arg_size || args.size > required_arg_size
end
# Number of arguments
View
7 test/runner_test.rb
@@ -240,6 +240,13 @@ def default_usage
my_command('blarg').should == ''
end
+ it 'prints error message for command missing required args' do
+ MyRunner.expects(:abort).with <<-STR.chomp
+my_command: 'mini' was called incorrectly.
+Usage: mini ME
+STR
+ my_command('mini').should == ''
+ end
it "allows no method error in command" do
assert_error(NoMethodError) { my_command('boom') }
end
Please sign in to comment.
Something went wrong with that request. Please try again.