File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,44 @@ module Concurrent
3
3
RSpec . describe Set do
4
4
let! ( :set ) { described_class . new }
5
5
6
+ describe '.[]' do
7
+ describe 'when initializing with no arguments' do
8
+ it do
9
+ expect ( described_class [ ] ) . to be_empty
10
+ end
11
+ end
12
+
13
+ describe 'when initializing with arguments' do
14
+ it 'creates a set with the given objects' do
15
+ expect ( described_class [ :hello , :world ] ) . to eq ::Set . new ( [ :hello , :world ] )
16
+ end
17
+ end
18
+ end
19
+
20
+ describe '.new' do
21
+ describe 'when initializing with no arguments' do
22
+ it do
23
+ expect ( described_class . new ) . to be_empty
24
+ end
25
+ end
26
+
27
+ describe 'when initializing with an enumerable object' do
28
+ let ( :enumerable_object ) { [ :hello , :world ] }
29
+
30
+ it 'creates a set with the contents of the enumerable object' do
31
+ expect ( described_class . new ( enumerable_object ) ) . to eq ::Set . new ( [ :hello , :world ] )
32
+ end
33
+
34
+ describe 'when initializing with a block argument' do
35
+ let ( :block_argument ) { proc { |value | :"#{ value } _ruby" } }
36
+
37
+ it 'creates a set with the contents of the enumerable object' do
38
+ expect ( described_class . new ( enumerable_object , &block_argument ) ) . to eq ::Set . new ( [ :hello_ruby , :world_ruby ] )
39
+ end
40
+ end
41
+ end
42
+ end
43
+
6
44
context 'concurrency' do
7
45
it do
8
46
( 1 ..Concurrent ::ThreadSafe ::Test ::THREADS ) . map do |i |
You can’t perform that action at this time.
0 commit comments