File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ class MutexCountDownLatch
20
20
# @param [Fixnum] count the initial count
21
21
#
22
22
# @raise [ArgumentError] if `count` is not an integer or is less than zero
23
- def initialize ( count )
23
+ def initialize ( count = 1 )
24
24
unless count . is_a? ( Fixnum ) && count >= 0
25
25
raise ArgumentError . new ( 'count must be in integer greater than or equal zero' )
26
26
end
@@ -75,7 +75,7 @@ def count
75
75
class JavaCountDownLatch
76
76
77
77
# @!macro count_down_latch_method_initialize
78
- def initialize ( count )
78
+ def initialize ( count = 1 )
79
79
unless count . is_a? ( Fixnum ) && count >= 0
80
80
raise ArgumentError . new ( 'count must be in integer greater than or equal zero' )
81
81
end
Original file line number Diff line number Diff line change 18
18
described_class . new ( 'foo' )
19
19
} . to raise_error ( ArgumentError )
20
20
end
21
+
22
+ it 'defaults the count to 1' do
23
+ latch = described_class . new
24
+ expect ( latch . count ) . to eq 1
25
+ end
21
26
end
22
27
23
28
describe '#count' do
You can’t perform that action at this time.
0 commit comments