rspec-bash 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/bash_stub.sh +14 -6
- data/bin/bash_wrapper.sh.erb +2 -2
- data/bin/ruby_stub.rb +4 -4
- data/lib/rspec/bash/command/call_configuration.rb +24 -7
- data/lib/rspec/bash/stubbed_env.rb +3 -3
- data/lib/rspec/bash/wrapper/stub_function.rb +1 -1
- data/rspec-bash.gemspec +1 -1
- data/spec/classes/command/call_configuration_spec.rb +104 -35
- data/spec/classes/stubbed_env_spec.rb +4 -4
- data/spec/classes/util/call_conf_argument_list_matcher_spec.rb +154 -154
- data/spec/classes/wrapper/ruby_stub_script_spec.rb +5 -5
- data/spec/integration/edge_cases/stub_internals_spec.rb +101 -0
- data/spec/integration/stubbed_command/outputs_spec.rb +46 -13
- data/spec/integration/stubbed_command/returns_exitstatus_spec.rb +0 -12
- data/spec/integration/stubbed_env/override_spec.rb +0 -25
- data/spec/integration/wrapper/bash_stub_script_spec.rb +49 -23
- data/spec/spec_helper.rb +25 -0
- metadata +4 -2
@@ -100,7 +100,7 @@ describe 'StubbedEnv' do
|
|
100
100
|
subject.stub_command('first_command')
|
101
101
|
subject.stub_command('second_command')
|
102
102
|
end
|
103
|
-
disallowed_commands = %w(
|
103
|
+
disallowed_commands = %w(command function)
|
104
104
|
disallowed_commands.each do |command|
|
105
105
|
it "does not allow #{command}" do
|
106
106
|
expect { subject.stub_command(command) }.to raise_error(
|
@@ -112,7 +112,7 @@ describe 'StubbedEnv' do
|
|
112
112
|
context '#execute' do
|
113
113
|
it 'wraps the file to execute and sends it to Open3' do
|
114
114
|
allow(stub_wrapper).to receive(:wrap_script)
|
115
|
-
.with('source file_to_execute')
|
115
|
+
.with('command source file_to_execute')
|
116
116
|
.and_return('wrapped script')
|
117
117
|
expect(Open3).to receive(:capture3)
|
118
118
|
.with({ 'DOG' => 'cat' }, 'wrapped script')
|
@@ -123,7 +123,7 @@ describe 'StubbedEnv' do
|
|
123
123
|
context('#execute_function') do
|
124
124
|
it 'wraps the file to execute and sends it to Open3' do
|
125
125
|
allow(stub_wrapper).to receive(:wrap_script)
|
126
|
-
.with("source file_to_execute\nfunction_to_execute")
|
126
|
+
.with("command source file_to_execute\nfunction_to_execute")
|
127
127
|
.and_return('wrapped script')
|
128
128
|
expect(Open3).to receive(:capture3)
|
129
129
|
.with({ 'DOG' => 'cat' }, 'wrapped script')
|
@@ -151,7 +151,7 @@ describe 'StubbedEnv' do
|
|
151
151
|
end
|
152
152
|
it 'wraps the file to execute and sends it to Open3' do
|
153
153
|
allow(stub_wrapper).to receive(:wrap_script)
|
154
|
-
.with('source file_to_execute')
|
154
|
+
.with('command source file_to_execute')
|
155
155
|
.and_return('wrapped script')
|
156
156
|
expect(Open3).to receive(:capture3)
|
157
157
|
.with({ 'DOG' => 'cat' }, 'wrapped script')
|
@@ -9,134 +9,134 @@ describe 'CallConfArgumentListMatcher' do
|
|
9
9
|
{
|
10
10
|
args: [],
|
11
11
|
exitcode: 6,
|
12
|
-
outputs:
|
13
|
-
{
|
12
|
+
outputs: {
|
13
|
+
stdout: {
|
14
14
|
target: :stdout,
|
15
15
|
content: 'seventh_content'
|
16
16
|
}
|
17
|
-
|
17
|
+
}
|
18
18
|
},
|
19
19
|
{
|
20
20
|
args: %w(first_argument second_argument third_argument),
|
21
21
|
exitcode: 1,
|
22
|
-
outputs:
|
23
|
-
{
|
22
|
+
outputs: {
|
23
|
+
stdout: {
|
24
24
|
target: :stdout,
|
25
25
|
content: 'second_content'
|
26
26
|
}
|
27
|
-
|
27
|
+
}
|
28
28
|
},
|
29
29
|
{
|
30
30
|
args: ['first_argument', anything, anything],
|
31
31
|
exitcode: 3,
|
32
|
-
outputs:
|
33
|
-
{
|
32
|
+
outputs: {
|
33
|
+
stdout: {
|
34
34
|
target: :stdout,
|
35
35
|
content: 'fourth_content'
|
36
36
|
}
|
37
|
-
|
37
|
+
}
|
38
38
|
},
|
39
39
|
{
|
40
40
|
args: [anything, 'second_argument'],
|
41
41
|
exitcode: 4,
|
42
|
-
outputs:
|
43
|
-
{
|
42
|
+
outputs: {
|
43
|
+
stdout: {
|
44
44
|
target: :stdout,
|
45
45
|
content: 'fifth_content'
|
46
46
|
}
|
47
|
-
|
47
|
+
}
|
48
48
|
},
|
49
49
|
{
|
50
50
|
args: %w(first_argument second_argument),
|
51
51
|
exitcode: 0,
|
52
|
-
outputs:
|
53
|
-
{
|
52
|
+
outputs: {
|
53
|
+
stdout: {
|
54
54
|
target: :stdout,
|
55
55
|
content: 'first_content'
|
56
56
|
}
|
57
|
-
|
57
|
+
}
|
58
58
|
},
|
59
59
|
{
|
60
60
|
args: %w(first_argument second_argument),
|
61
61
|
exitcode: 2,
|
62
|
-
outputs:
|
63
|
-
{
|
62
|
+
outputs: {
|
63
|
+
stdout: {
|
64
64
|
target: :stdout,
|
65
65
|
content: 'third_content'
|
66
66
|
}
|
67
|
-
|
67
|
+
}
|
68
68
|
},
|
69
69
|
{
|
70
70
|
args: [anything, anything, anything, anything],
|
71
71
|
exitcode: 5,
|
72
|
-
outputs:
|
73
|
-
{
|
72
|
+
outputs: {
|
73
|
+
stdout: {
|
74
74
|
target: :stdout,
|
75
75
|
content: 'sixth_content'
|
76
76
|
}
|
77
|
-
|
77
|
+
}
|
78
78
|
},
|
79
79
|
{
|
80
80
|
args: [anything, anything, 'third_argument', anything, anything],
|
81
81
|
exitcode: 7,
|
82
|
-
outputs:
|
83
|
-
{
|
82
|
+
outputs: {
|
83
|
+
stdout: {
|
84
84
|
target: :stdout,
|
85
85
|
content: 'eighth_content'
|
86
86
|
}
|
87
|
-
|
87
|
+
}
|
88
88
|
},
|
89
89
|
{
|
90
90
|
args: [anything, anything, anything, anything, anything],
|
91
91
|
exitcode: 8,
|
92
|
-
outputs:
|
93
|
-
{
|
92
|
+
outputs: {
|
93
|
+
stdout: {
|
94
94
|
target: :stdout,
|
95
95
|
content: 'ninth_content'
|
96
96
|
}
|
97
|
-
|
97
|
+
}
|
98
98
|
},
|
99
99
|
{
|
100
100
|
args: [anything],
|
101
101
|
exitcode: 9,
|
102
|
-
outputs:
|
103
|
-
{
|
102
|
+
outputs: {
|
103
|
+
stdout: {
|
104
104
|
target: :stdout,
|
105
105
|
content: 'tenth_content'
|
106
106
|
}
|
107
|
-
|
107
|
+
}
|
108
108
|
},
|
109
109
|
{
|
110
110
|
args: [anything],
|
111
111
|
exitcode: 10,
|
112
|
-
outputs:
|
113
|
-
{
|
112
|
+
outputs: {
|
113
|
+
stdout: {
|
114
114
|
target: :stdout,
|
115
115
|
content: 'eleventh_content'
|
116
116
|
}
|
117
|
-
|
117
|
+
}
|
118
118
|
}
|
119
119
|
]
|
120
120
|
end
|
121
121
|
|
122
122
|
it 'returns the longest conf match' do
|
123
123
|
argument_list_from_call = %w(first_argument second_argument third_argument)
|
124
|
-
subject
|
125
|
-
call_conf_match
|
124
|
+
subject = CallConfArgumentListMatcher.new(call_conf_list)
|
125
|
+
call_conf_match = subject.get_best_call_conf(argument_list_from_call)
|
126
126
|
expect(call_conf_match).to eql call_conf_list.at(2)
|
127
127
|
end
|
128
128
|
|
129
129
|
it 'returns the last longest conf match for multiple exact matches' do
|
130
130
|
argument_list_from_call = %w(first_argument second_argument)
|
131
|
-
subject
|
132
|
-
call_conf_match
|
131
|
+
subject = CallConfArgumentListMatcher.new(call_conf_list)
|
132
|
+
call_conf_match = subject.get_best_call_conf(argument_list_from_call)
|
133
133
|
expect(call_conf_match).to eql call_conf_list.at(5)
|
134
134
|
end
|
135
135
|
|
136
136
|
it 'returns the longest conf match for any_arg v. anything matches' do
|
137
137
|
argument_list_from_call = %w(first_argument second_argument third_argument fourth_argument)
|
138
|
-
subject
|
139
|
-
call_conf_match
|
138
|
+
subject = CallConfArgumentListMatcher.new(call_conf_list)
|
139
|
+
call_conf_match = subject.get_best_call_conf(argument_list_from_call)
|
140
140
|
expect(call_conf_match).to eql call_conf_list.at(6)
|
141
141
|
end
|
142
142
|
|
@@ -145,15 +145,15 @@ describe 'CallConfArgumentListMatcher' do
|
|
145
145
|
first_argument second_argument third_argument
|
146
146
|
fourth_argument fifth_argument
|
147
147
|
)
|
148
|
-
subject
|
149
|
-
call_conf_match
|
148
|
+
subject = CallConfArgumentListMatcher.new(call_conf_list)
|
149
|
+
call_conf_match = subject.get_best_call_conf(argument_list_from_call)
|
150
150
|
expect(call_conf_match).to eql call_conf_list.at(8)
|
151
151
|
end
|
152
152
|
|
153
153
|
it 'returns the last anything match for multiple, all anything matches' do
|
154
154
|
argument_list_from_call = %w(first_argument)
|
155
|
-
subject
|
156
|
-
call_conf_match
|
155
|
+
subject = CallConfArgumentListMatcher.new(call_conf_list)
|
156
|
+
call_conf_match = subject.get_best_call_conf(argument_list_from_call)
|
157
157
|
expect(call_conf_match).to eql call_conf_list.at(10)
|
158
158
|
end
|
159
159
|
end
|
@@ -163,62 +163,62 @@ describe 'CallConfArgumentListMatcher' do
|
|
163
163
|
{
|
164
164
|
args: %w(first_argument second_argument),
|
165
165
|
exitcode: 0,
|
166
|
-
outputs:
|
167
|
-
{
|
166
|
+
outputs: {
|
167
|
+
stdout: {
|
168
168
|
target: :stdout,
|
169
169
|
content: 'first_content'
|
170
170
|
}
|
171
|
-
|
171
|
+
}
|
172
172
|
},
|
173
173
|
{
|
174
174
|
args: %w(first_argument second_argument third_argument),
|
175
175
|
exitcode: 1,
|
176
|
-
outputs:
|
177
|
-
{
|
176
|
+
outputs: {
|
177
|
+
stdout: {
|
178
178
|
target: :stdout,
|
179
179
|
content: 'second_content'
|
180
180
|
}
|
181
|
-
|
181
|
+
}
|
182
182
|
},
|
183
183
|
{
|
184
184
|
args: %w(first_argument second_argument),
|
185
185
|
exitcode: 2,
|
186
|
-
outputs:
|
187
|
-
{
|
186
|
+
outputs: {
|
187
|
+
stdout: {
|
188
188
|
target: :stdout,
|
189
189
|
content: 'third_content'
|
190
190
|
}
|
191
|
-
|
191
|
+
}
|
192
192
|
},
|
193
193
|
{
|
194
194
|
args: ['first_argument', anything, 'third_argument'],
|
195
195
|
exitcode: 3,
|
196
|
-
outputs:
|
197
|
-
{
|
196
|
+
outputs: {
|
197
|
+
stdout: {
|
198
198
|
target: :stdout,
|
199
199
|
content: 'fourth_content'
|
200
200
|
}
|
201
|
-
|
201
|
+
}
|
202
202
|
},
|
203
203
|
{
|
204
204
|
args: [anything, 'second_argument'],
|
205
205
|
exitcode: 4,
|
206
|
-
outputs:
|
207
|
-
{
|
206
|
+
outputs: {
|
207
|
+
stdout: {
|
208
208
|
target: :stdout,
|
209
209
|
content: 'fifth_content'
|
210
210
|
}
|
211
|
-
|
211
|
+
}
|
212
212
|
},
|
213
213
|
{
|
214
214
|
args: [anything, anything, anything, anything],
|
215
215
|
exitcode: 5,
|
216
|
-
outputs:
|
217
|
-
{
|
216
|
+
outputs: {
|
217
|
+
stdout: {
|
218
218
|
target: :stdout,
|
219
219
|
content: 'sixth_content'
|
220
220
|
}
|
221
|
-
|
221
|
+
}
|
222
222
|
}
|
223
223
|
]
|
224
224
|
end
|
@@ -226,8 +226,8 @@ describe 'CallConfArgumentListMatcher' do
|
|
226
226
|
it 'returns an empty conf for no matches' do
|
227
227
|
argument_list_from_call =
|
228
228
|
%w(first_argument second_argument third_argument fourth_argument fifth_argument)
|
229
|
-
subject
|
230
|
-
call_conf_match
|
229
|
+
subject = CallConfArgumentListMatcher.new(call_conf_list)
|
230
|
+
call_conf_match = subject.get_best_call_conf(argument_list_from_call)
|
231
231
|
expect(call_conf_match).to be_empty
|
232
232
|
end
|
233
233
|
end
|
@@ -239,72 +239,72 @@ describe 'CallConfArgumentListMatcher' do
|
|
239
239
|
{
|
240
240
|
args: %w(first_argument second_argument),
|
241
241
|
exitcode: 0,
|
242
|
-
outputs:
|
243
|
-
{
|
242
|
+
outputs: {
|
243
|
+
stdout: {
|
244
244
|
target: :stdout,
|
245
245
|
content: 'first_content'
|
246
246
|
}
|
247
|
-
|
247
|
+
}
|
248
248
|
},
|
249
249
|
{
|
250
250
|
args: %w(first_argument second_argument third_argument),
|
251
251
|
exitcode: 1,
|
252
|
-
outputs:
|
253
|
-
{
|
252
|
+
outputs: {
|
253
|
+
stdout: {
|
254
254
|
target: :stdout,
|
255
255
|
content: 'second_content'
|
256
256
|
}
|
257
|
-
|
257
|
+
}
|
258
258
|
},
|
259
259
|
{
|
260
260
|
args: %w(first_argument second_argument),
|
261
261
|
exitcode: 2,
|
262
|
-
outputs:
|
263
|
-
{
|
262
|
+
outputs: {
|
263
|
+
stdout: {
|
264
264
|
target: :stdout,
|
265
265
|
content: 'third_content'
|
266
266
|
}
|
267
|
-
|
267
|
+
}
|
268
268
|
},
|
269
269
|
{
|
270
270
|
args: ['first_argument', YAML.load(YAML.dump(anything)), 'third_argument'],
|
271
271
|
exitcode: 3,
|
272
|
-
outputs:
|
273
|
-
{
|
272
|
+
outputs: {
|
273
|
+
stdout: {
|
274
274
|
target: :stdout,
|
275
275
|
content: 'fourth_content'
|
276
276
|
}
|
277
|
-
|
277
|
+
}
|
278
278
|
},
|
279
279
|
{
|
280
280
|
args: [anything, 'second_argument'],
|
281
281
|
exitcode: 4,
|
282
|
-
outputs:
|
283
|
-
{
|
282
|
+
outputs: {
|
283
|
+
stdout: {
|
284
284
|
target: :stdout,
|
285
285
|
content: 'fifth_content'
|
286
286
|
}
|
287
|
-
|
287
|
+
}
|
288
288
|
},
|
289
289
|
{
|
290
290
|
args: [anything, anything, anything, anything],
|
291
291
|
exitcode: 5,
|
292
|
-
outputs:
|
293
|
-
{
|
292
|
+
outputs: {
|
293
|
+
stdout: {
|
294
294
|
target: :stdout,
|
295
295
|
content: 'sixth_content'
|
296
296
|
}
|
297
|
-
|
297
|
+
}
|
298
298
|
},
|
299
299
|
{
|
300
300
|
args: [],
|
301
301
|
exitcode: 6,
|
302
|
-
outputs:
|
303
|
-
{
|
302
|
+
outputs: {
|
303
|
+
stdout: {
|
304
304
|
target: :stdout,
|
305
305
|
content: 'seventh_content'
|
306
306
|
}
|
307
|
-
|
307
|
+
}
|
308
308
|
},
|
309
309
|
{
|
310
310
|
args: [
|
@@ -312,12 +312,12 @@ describe 'CallConfArgumentListMatcher' do
|
|
312
312
|
'third_argument', 'fourth_argument', any_args
|
313
313
|
],
|
314
314
|
exitcode: 6,
|
315
|
-
outputs:
|
316
|
-
{
|
315
|
+
outputs: {
|
316
|
+
stdout: {
|
317
317
|
target: :stdout,
|
318
318
|
content: 'seventh_content'
|
319
319
|
}
|
320
|
-
|
320
|
+
}
|
321
321
|
},
|
322
322
|
{
|
323
323
|
args: [
|
@@ -325,34 +325,34 @@ describe 'CallConfArgumentListMatcher' do
|
|
325
325
|
'third_argument', 'fourth_argument', YAML.load(YAML.dump(any_args))
|
326
326
|
],
|
327
327
|
exitcode: 6,
|
328
|
-
outputs:
|
329
|
-
{
|
328
|
+
outputs: {
|
329
|
+
stdout: {
|
330
330
|
target: :stdout,
|
331
331
|
content: 'seventh_content'
|
332
332
|
}
|
333
|
-
|
333
|
+
}
|
334
334
|
}
|
335
335
|
]
|
336
336
|
end
|
337
337
|
|
338
338
|
it 'returns the correct confs for a single exact/anything argument match' do
|
339
339
|
argument_list_from_call = %w(first_argument second_argument third_argument)
|
340
|
-
subject
|
341
|
-
call_conf_match_list
|
340
|
+
subject = CallConfArgumentListMatcher.new(call_conf_list)
|
341
|
+
call_conf_match_list = subject.get_call_conf_matches(argument_list_from_call)
|
342
342
|
expect(call_conf_match_list).to eql call_conf_list.values_at(1, 3, 6)
|
343
343
|
end
|
344
344
|
|
345
345
|
it 'returns the correct confs for multiple exact/anything argument matches' do
|
346
346
|
argument_list_from_call = %w(first_argument second_argument)
|
347
|
-
subject
|
348
|
-
call_conf_match_list
|
347
|
+
subject = CallConfArgumentListMatcher.new(call_conf_list)
|
348
|
+
call_conf_match_list = subject.get_call_conf_matches(argument_list_from_call)
|
349
349
|
expect(call_conf_match_list).to eql call_conf_list.values_at(0, 2, 4, 6)
|
350
350
|
end
|
351
351
|
|
352
352
|
it 'returns the correct confs for the all argument match' do
|
353
353
|
argument_list_from_call = %w(first_argument)
|
354
|
-
subject
|
355
|
-
call_conf_match_list
|
354
|
+
subject = CallConfArgumentListMatcher.new(call_conf_list)
|
355
|
+
call_conf_match_list = subject.get_call_conf_matches(argument_list_from_call)
|
356
356
|
expect(call_conf_match_list).to eql call_conf_list.values_at(6)
|
357
357
|
end
|
358
358
|
|
@@ -361,8 +361,8 @@ describe 'CallConfArgumentListMatcher' do
|
|
361
361
|
first_argument second_argument
|
362
362
|
third_argument fourth_argument fifth_argument
|
363
363
|
)
|
364
|
-
subject
|
365
|
-
actual_args_match
|
364
|
+
subject = CallConfArgumentListMatcher.new(call_conf_list)
|
365
|
+
actual_args_match = subject.get_call_conf_matches(argument_list_from_call)
|
366
366
|
expect(actual_args_match).to eql call_conf_list.values_at(6, 7, 8)
|
367
367
|
end
|
368
368
|
end
|
@@ -374,94 +374,94 @@ describe 'CallConfArgumentListMatcher' do
|
|
374
374
|
{
|
375
375
|
args: %w(first_argument second_argument),
|
376
376
|
exitcode: 0,
|
377
|
-
outputs:
|
378
|
-
{
|
377
|
+
outputs: {
|
378
|
+
stdout: {
|
379
379
|
target: :stdout,
|
380
380
|
content: 'first_content'
|
381
381
|
}
|
382
|
-
|
382
|
+
}
|
383
383
|
},
|
384
384
|
{
|
385
385
|
args: %w(first_argument second_argument third_argument),
|
386
386
|
exitcode: 1,
|
387
|
-
outputs:
|
388
|
-
{
|
387
|
+
outputs: {
|
388
|
+
stdout: {
|
389
389
|
target: :stdout,
|
390
390
|
content: 'second_content'
|
391
391
|
}
|
392
|
-
|
392
|
+
}
|
393
393
|
},
|
394
394
|
{
|
395
395
|
args: %w(first_argument second_argument),
|
396
396
|
exitcode: 2,
|
397
|
-
outputs:
|
398
|
-
{
|
397
|
+
outputs: {
|
398
|
+
stdout: {
|
399
399
|
target: :stdout,
|
400
400
|
content: 'third_content'
|
401
401
|
}
|
402
|
-
|
402
|
+
}
|
403
403
|
},
|
404
404
|
{
|
405
405
|
args: ['first_argument', anything, 'third_argument'],
|
406
406
|
exitcode: 3,
|
407
|
-
outputs:
|
408
|
-
{
|
407
|
+
outputs: {
|
408
|
+
stdout: {
|
409
409
|
target: :stdout,
|
410
410
|
content: 'fourth_content'
|
411
411
|
}
|
412
|
-
|
412
|
+
}
|
413
413
|
},
|
414
414
|
{
|
415
415
|
args: [anything, 'second_argument'],
|
416
416
|
exitcode: 4,
|
417
|
-
outputs:
|
418
|
-
{
|
417
|
+
outputs: {
|
418
|
+
stdout: {
|
419
419
|
target: :stdout,
|
420
420
|
content: 'fifth_content'
|
421
421
|
}
|
422
|
-
|
422
|
+
}
|
423
423
|
},
|
424
424
|
{
|
425
425
|
args: [anything, anything, anything, anything],
|
426
426
|
exitcode: 5,
|
427
|
-
outputs:
|
428
|
-
{
|
427
|
+
outputs: {
|
428
|
+
stdout: {
|
429
429
|
target: :stdout,
|
430
430
|
content: 'sixth_content'
|
431
431
|
}
|
432
|
-
|
432
|
+
}
|
433
433
|
},
|
434
434
|
{
|
435
435
|
args: [],
|
436
436
|
exitcode: 7,
|
437
|
-
outputs:
|
438
|
-
{
|
437
|
+
outputs: {
|
438
|
+
stdout: {
|
439
439
|
target: :stdout,
|
440
440
|
content: 'eighth_content'
|
441
441
|
}
|
442
|
-
|
442
|
+
}
|
443
443
|
}
|
444
444
|
]
|
445
445
|
end
|
446
446
|
|
447
447
|
it 'returns the correct confs for a single exact/anything argument match' do
|
448
448
|
argument_list_from_call = %w(first_argument second_argument third_argument)
|
449
|
-
subject
|
450
|
-
actual_args_match
|
449
|
+
subject = CallConfArgumentListMatcher.new(call_conf_list)
|
450
|
+
actual_args_match = subject.args_match?(argument_list_from_call)
|
451
451
|
expect(actual_args_match).to be true
|
452
452
|
end
|
453
453
|
|
454
454
|
it 'returns the correct confs for multiple exact/anything argument matches' do
|
455
455
|
argument_list_from_call = %w(first_argument second_argument)
|
456
|
-
subject
|
457
|
-
actual_args_match
|
456
|
+
subject = CallConfArgumentListMatcher.new(call_conf_list)
|
457
|
+
actual_args_match = subject.args_match?(argument_list_from_call)
|
458
458
|
expect(actual_args_match).to be true
|
459
459
|
end
|
460
460
|
|
461
461
|
it 'returns the correct confs for the all argument match' do
|
462
462
|
argument_list_from_call = %w(first_argument)
|
463
|
-
subject
|
464
|
-
actual_args_match
|
463
|
+
subject = CallConfArgumentListMatcher.new(call_conf_list)
|
464
|
+
actual_args_match = subject.args_match?(argument_list_from_call)
|
465
465
|
expect(actual_args_match).to be true
|
466
466
|
end
|
467
467
|
end
|
@@ -471,62 +471,62 @@ describe 'CallConfArgumentListMatcher' do
|
|
471
471
|
{
|
472
472
|
args: %w(first_argument second_argument),
|
473
473
|
exitcode: 0,
|
474
|
-
outputs:
|
475
|
-
{
|
474
|
+
outputs: {
|
475
|
+
stdout: {
|
476
476
|
target: :stdout,
|
477
477
|
content: 'first_content'
|
478
478
|
}
|
479
|
-
|
479
|
+
}
|
480
480
|
},
|
481
481
|
{
|
482
482
|
args: %w(first_argument second_argument third_argument),
|
483
483
|
exitcode: 1,
|
484
|
-
outputs:
|
485
|
-
{
|
484
|
+
outputs: {
|
485
|
+
stdout: {
|
486
486
|
target: :stdout,
|
487
487
|
content: 'second_content'
|
488
488
|
}
|
489
|
-
|
489
|
+
}
|
490
490
|
},
|
491
491
|
{
|
492
492
|
args: %w(first_argument second_argument),
|
493
493
|
exitcode: 2,
|
494
|
-
outputs:
|
495
|
-
{
|
494
|
+
outputs: {
|
495
|
+
stdout: {
|
496
496
|
target: :stdout,
|
497
497
|
content: 'third_content'
|
498
498
|
}
|
499
|
-
|
499
|
+
}
|
500
500
|
},
|
501
501
|
{
|
502
502
|
args: ['first_argument', anything, 'third_argument'],
|
503
503
|
exitcode: 3,
|
504
|
-
outputs:
|
505
|
-
{
|
504
|
+
outputs: {
|
505
|
+
stdout: {
|
506
506
|
target: :stdout,
|
507
507
|
content: 'fourth_content'
|
508
508
|
}
|
509
|
-
|
509
|
+
}
|
510
510
|
},
|
511
511
|
{
|
512
512
|
args: [anything, 'second_argument'],
|
513
513
|
exitcode: 4,
|
514
|
-
outputs:
|
515
|
-
{
|
514
|
+
outputs: {
|
515
|
+
stdout: {
|
516
516
|
target: :stdout,
|
517
517
|
content: 'fifth_content'
|
518
518
|
}
|
519
|
-
|
519
|
+
}
|
520
520
|
},
|
521
521
|
{
|
522
522
|
args: [anything, anything, anything, anything],
|
523
523
|
exitcode: 5,
|
524
|
-
outputs:
|
525
|
-
{
|
524
|
+
outputs: {
|
525
|
+
stdout: {
|
526
526
|
target: :stdout,
|
527
527
|
content: 'sixth_content'
|
528
528
|
}
|
529
|
-
|
529
|
+
}
|
530
530
|
},
|
531
531
|
{
|
532
532
|
args: [
|
@@ -534,34 +534,34 @@ describe 'CallConfArgumentListMatcher' do
|
|
534
534
|
'third_argument', 'fourth_argument', any_args
|
535
535
|
],
|
536
536
|
exitcode: 6,
|
537
|
-
outputs:
|
538
|
-
{
|
537
|
+
outputs: {
|
538
|
+
stdout: {
|
539
539
|
target: :stdout,
|
540
540
|
content: 'seventh_content'
|
541
541
|
}
|
542
|
-
|
542
|
+
}
|
543
543
|
}
|
544
544
|
]
|
545
545
|
end
|
546
546
|
|
547
547
|
it 'returns the correct confs for a single exact/anything argument match' do
|
548
548
|
argument_list_from_call = %w(first_argument second_argument third_argument)
|
549
|
-
subject
|
550
|
-
actual_args_match
|
549
|
+
subject = CallConfArgumentListMatcher.new(call_conf_list)
|
550
|
+
actual_args_match = subject.args_match?(argument_list_from_call)
|
551
551
|
expect(actual_args_match).to be true
|
552
552
|
end
|
553
553
|
|
554
554
|
it 'returns the correct confs for multiple exact/anything argument matches' do
|
555
555
|
argument_list_from_call = %w(first_argument second_argument)
|
556
|
-
subject
|
557
|
-
actual_args_match
|
556
|
+
subject = CallConfArgumentListMatcher.new(call_conf_list)
|
557
|
+
actual_args_match = subject.args_match?(argument_list_from_call)
|
558
558
|
expect(actual_args_match).to be true
|
559
559
|
end
|
560
560
|
|
561
561
|
it 'returns the correct confs for the all argument match' do
|
562
562
|
argument_list_from_call = %w(first_argument)
|
563
|
-
subject
|
564
|
-
actual_args_match
|
563
|
+
subject = CallConfArgumentListMatcher.new(call_conf_list)
|
564
|
+
actual_args_match = subject.args_match?(argument_list_from_call)
|
565
565
|
expect(actual_args_match).to be false
|
566
566
|
end
|
567
567
|
|
@@ -570,8 +570,8 @@ describe 'CallConfArgumentListMatcher' do
|
|
570
570
|
first_argument second_argument
|
571
571
|
third_argument fourth_argument fifth_argument
|
572
572
|
)
|
573
|
-
subject
|
574
|
-
actual_args_match
|
573
|
+
subject = CallConfArgumentListMatcher.new(call_conf_list)
|
574
|
+
actual_args_match = subject.args_match?(argument_list_from_call)
|
575
575
|
expect(actual_args_match).to be true
|
576
576
|
end
|
577
577
|
end
|