@@ -76,116 +76,49 @@ def call(num_groups, options = {})
76
76
)
77
77
end
78
78
79
- context 'with specific groups provided directly ' do
80
- it "groups specify_groups as specified when specify_groups is just one spec" do
79
+ context 'specify_groups ' do
80
+ it "groups with one spec" do
81
81
expect ( call ( 3 , specify_groups : '1' ) ) . to eq ( [ [ "1" ] , [ "2" , "5" ] , [ "3" , "4" ] ] )
82
82
end
83
83
84
- it "groups specify_groups as specified when specify_groups is just multiple specs in one process" do
84
+ it "groups with multiple specs in one process" do
85
85
expect ( call ( 3 , specify_groups : '3,1' ) ) . to eq ( [ [ "3" , "1" ] , [ "5" ] , [ "2" , "4" ] ] )
86
86
end
87
87
88
- it "groups specify_groups as specified when specify_groups is multiple specs " do
88
+ it "groups with multiple specs and multiple processes " do
89
89
expect ( call ( 3 , specify_groups : '1,2|4' ) ) . to eq ( [ [ "1" , "2" ] , [ "4" ] , [ "3" , "5" ] ] )
90
90
end
91
91
92
- it "specify_groups aborts when number of specs separated by pipe is out of bounds " do
92
+ it "aborts when number of specs is higher than number of processes " do
93
93
expect do
94
94
call ( 3 , specify_groups : '1|2|3|4' )
95
95
end . to raise_error (
96
96
"Number of processes separated by pipe must be less than or equal to the total number of processes"
97
97
)
98
98
end
99
99
100
- it "specify_groups aborts when spec passed in doesn't match existing specs" do
100
+ it "aborts when spec passed in doesn't match existing specs" do
101
101
expect do
102
102
call ( 3 , specify_groups : '1|2|6' )
103
103
end . to raise_error (
104
104
"Could not find [\" 6\" ] from --specify-groups in the selected files & folders"
105
105
)
106
106
end
107
107
108
- it "specify_groups aborts when spec passed in doesn't match existing specs again" do
109
- expect do
110
- call ( 3 , specify_groups : '1,6|2' )
111
- end . to raise_error (
112
- "Could not find [\" 6\" ] from --specify-groups in the selected files & folders"
113
- )
114
- end
115
-
116
- it "specify_groups aborts when number of specs is equal to number passed in" do
108
+ it "aborts when number of specs is equal to number of processes and not all specs are used" do
117
109
expect do
118
110
call ( 3 , specify_groups : '1|2|3' )
119
111
end . to raise_error ( /The specs that aren't run:\n \[ "4", "5"\] / )
120
112
end
121
113
122
- it "specify_groups does not abort when the every single spec is specified in it " do
114
+ it "does not abort when the every single spec is specified" do
123
115
expect ( call ( 3 , specify_groups : '1,2|3,4|5' ) ) . to eq ( [ [ "1" , "2" ] , [ "3" , "4" ] , [ "5" ] ] )
124
116
end
125
- end
126
-
127
- context 'with specific groups provided through STDIN' do
128
- it "groups specify_groups as specified when specify_groups is just one spec" do
129
- allow ( $stdin) . to receive ( :read ) . and_return ( "1\n " )
130
117
131
- expect ( call ( 3 , specify_groups : '-' ) ) . to eq ( [ [ "1" ] , [ "2" , "5" ] , [ "3" , "4" ] ] )
132
- end
133
-
134
- it "groups specify_groups as specified when specify_groups is just multiple specs in one process" do
118
+ it "can read from stdin" do
135
119
allow ( $stdin) . to receive ( :read ) . and_return ( "3,1\n " )
136
-
137
120
expect ( call ( 3 , specify_groups : '-' ) ) . to eq ( [ [ "3" , "1" ] , [ "5" ] , [ "2" , "4" ] ] )
138
121
end
139
-
140
- it "groups specify_groups as specified when specify_groups is multiple specs" do
141
- allow ( $stdin) . to receive ( :read ) . and_return ( "1,2|4\n " )
142
-
143
- expect ( call ( 3 , specify_groups : '-' ) ) . to eq ( [ [ "1" , "2" ] , [ "4" ] , [ "3" , "5" ] ] )
144
- end
145
-
146
- it "specify_groups aborts when number of specs separated by pipe is out of bounds" do
147
- allow ( $stdin) . to receive ( :read ) . and_return ( "1|2|3|4\n " )
148
-
149
- expect do
150
- call ( 3 , specify_groups : '-' )
151
- end . to raise_error (
152
- "Number of processes separated by pipe must be less than or equal to the total number of processes"
153
- )
154
- end
155
-
156
- it "specify_groups aborts when spec passed in doesn't match existing specs" do
157
- allow ( $stdin) . to receive ( :read ) . and_return ( "1|2|6\n " )
158
-
159
- expect do
160
- call ( 3 , specify_groups : '-' )
161
- end . to raise_error (
162
- "Could not find [\" 6\" ] from --specify-groups in the selected files & folders"
163
- )
164
- end
165
-
166
- it "specify_groups aborts when spec passed in doesn't match existing specs again" do
167
- allow ( $stdin) . to receive ( :read ) . and_return ( "1,6|2\n " )
168
-
169
- expect do
170
- call ( 3 , specify_groups : '-' )
171
- end . to raise_error (
172
- "Could not find [\" 6\" ] from --specify-groups in the selected files & folders"
173
- )
174
- end
175
-
176
- it "specify_groups aborts when number of specs is equal to number passed in" do
177
- allow ( $stdin) . to receive ( :read ) . and_return ( "1|2|3\n " )
178
-
179
- expect do
180
- call ( 3 , specify_groups : '-' )
181
- end . to raise_error ( /The specs that aren't run:\n \[ "4", "5"\] / )
182
- end
183
-
184
- it "specify_groups does not abort when the every single spec is specified in it" do
185
- allow ( $stdin) . to receive ( :read ) . and_return ( "1,2|3,4|5\n " )
186
-
187
- expect ( call ( 3 , specify_groups : '-' ) ) . to eq ( [ [ "1" , "2" ] , [ "3" , "4" ] , [ "5" ] ] )
188
- end
189
122
end
190
123
end
191
124
0 commit comments