Commit 7ecb025 1 parent 43c1c74 commit 7ecb025 Copy full SHA for 7ecb025
File tree 2 files changed +25
-0
lines changed
2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -122,6 +122,13 @@ def has?(key)
122
122
@source . key? ( key . to_sym )
123
123
end
124
124
125
+ # Return whether the argument set has no arguments within?
126
+ #
127
+ # @return [Boolean]
128
+ def empty?
129
+ @source . empty?
130
+ end
131
+
125
132
# Validate an argument set and return any errors as appropriate
126
133
#
127
134
# @param argument [Apia::Argument]
Original file line number Diff line number Diff line change 416
416
end
417
417
end
418
418
419
+ context '#empty' do
420
+ it 'is true if there are no arguments' do
421
+ as = Apia ::ArgumentSet . create ( 'ExampleSet' ) do
422
+ argument :name , type : :string
423
+ end
424
+ instance = as . new ( { } )
425
+ expect ( instance . empty? ) . to be true
426
+ end
427
+
428
+ it 'is false if there are arguments' do
429
+ as = Apia ::ArgumentSet . create ( 'ExampleSet' ) do
430
+ argument :name , type : :string
431
+ end
432
+ instance = as . new ( { name : 'Dave' } )
433
+ expect ( instance . empty? ) . to be false
434
+ end
435
+ end
436
+
419
437
context '#to_hash' do
420
438
it 'should return a hash of the values' do
421
439
as = Apia ::ArgumentSet . create ( 'ExampleSet' ) do
You can’t perform that action at this time.
0 commit comments