test/test_has_arguments.rb in rubikon-0.4.1 vs test/test_has_arguments.rb in rubikon-0.5.0
- old
+ new
@@ -20,75 +20,75 @@
context 'A parameter with arguments' do
should 'allow a Numeric as argument count' do
has_arg = HasArg.new(1)
- assert_equal 1..1, has_arg.arg_count
+ assert_equal 1..1, has_arg.send(:arg_count)
assert_nil has_arg.arg_names
end
should 'allow a Range as argument count' do
has_arg = HasArg.new(1..3)
- assert_equal 1..3, has_arg.arg_count
+ assert_equal 1..3, has_arg.send(:arg_count)
assert_nil has_arg.arg_names
end
should 'allow an Array as argument count' do
has_arg = HasArg.new([2, 5, 6])
- assert_equal 2..6, has_arg.arg_count
+ assert_equal 2..6, has_arg.send(:arg_count)
assert_nil has_arg.arg_names
end
should 'allow a Symbol Array as argument names' do
has_arg = HasArg.new([:arg1, :arg2, :arg3])
- assert_equal 3..3, has_arg.arg_count
+ assert_equal 3..3, has_arg.send(:arg_count)
assert_equal [:arg1, :arg2, :arg3], has_arg.arg_names
end
should 'only have required arguments if argument count is > 0' do
has_arg = HasArg.new(2)
- assert !has_arg.args_full?
- assert has_arg.more_args?
- has_arg << 'argument'
+ assert !has_arg.send(:args_full?)
+ assert has_arg.send(:more_args?)
+ has_arg.send(:<<, 'argument')
assert_equal %w{argument}, has_arg.args
assert_raise MissingArgumentError do
- has_arg.check_args
+ has_arg.send :check_args
end
- has_arg << 'argument'
- assert has_arg.args_full?
- assert !has_arg.more_args?
+ has_arg.send(:<<, 'argument')
+ assert has_arg.send(:args_full?)
+ assert !has_arg.send(:more_args?)
assert_equal %w{argument argument}, has_arg.args
assert_raise ExtraArgumentError do
- has_arg << 'argument'
+ has_arg.send(:<<, 'argument')
end
assert_equal %w{argument argument}, has_arg.args
end
should 'have required and optional arguments if argument count is < 0' do
has_arg = HasArg.new(-1)
- assert !has_arg.args_full?
- assert has_arg.more_args?
+ assert !has_arg.send(:args_full?)
+ assert has_arg.send(:more_args?)
assert_raise MissingArgumentError do
- has_arg.check_args
+ has_arg.send :check_args
end
- has_arg << 'argument'
- assert has_arg.args_full?
- assert has_arg.more_args?
+ has_arg.send(:<<, 'argument')
+ assert has_arg.send(:args_full?)
+ assert has_arg.send(:more_args?)
assert_equal %w{argument}, has_arg.args
end
should 'only have optional arguments if argument count is 0' do
has_arg = HasArg.new(0)
- assert has_arg.args_full?
- assert has_arg.more_args?
- has_arg << 'argument'
+ assert has_arg.send(:args_full?)
+ assert has_arg.send(:more_args?)
+ has_arg.send(:<<, 'argument')
assert_equal %w{argument}, has_arg.args
end
should 'provide named arguments' do
has_arg = HasArg.new([:named])
- has_arg << 'argument'
+ has_arg.send(:<<, 'argument')
assert_equal 'argument', has_arg[:named]
assert_equal 'argument', has_arg.named
assert_raise NoMethodError do
has_arg.not_named
end
@@ -97,11 +97,11 @@
should 'call its code block if it is activated' do
block_run = false
has_arg = HasArg.new nil do
block_run = true
end
- has_arg.active!
- assert has_arg.active?
+ has_arg.send :active!
+ assert has_arg.send(:active?)
assert block_run
end
end