@@ -331,6 +331,70 @@ module Matrix
331
331
end
332
332
end
333
333
end
334
+
335
+ describe "specifying a provider which has multiple prod versions of one consumer (explicit) and a single version of another (inferred)" do
336
+ before do
337
+ # Foo 1 (prod) -> Bar 2 [explicit]
338
+ # Foo 2 (prod) -> Bar 2 [explicit]
339
+ # Foo 3 -> Bar 2 failed [explicit]
340
+ # Cat 20 (prod) -> Bar ? [inferred, missing verification]
341
+ # Dog 40 -> Bar 2 failed [inferred, but not in prod]
342
+
343
+ td . create_pact_with_verification ( "Foo" , "1" , "Bar" , "2" )
344
+ . create_consumer_version_tag ( "prod" )
345
+ . create_consumer_version ( "2" )
346
+ . create_consumer_version_tag ( "prod" )
347
+ . create_pact
348
+ . create_verification ( provider_version : "2" )
349
+ . create_consumer_version ( "3" )
350
+ . create_pact
351
+ . create_verification ( provider_version : "2" , success : false , comment : "not prod, doesn't matter" )
352
+ . create_consumer ( "Cat" )
353
+ . create_consumer_version ( "20" )
354
+ . create_consumer_version_tag ( "prod" )
355
+ . create_pact
356
+ . comment ( "missing verification" )
357
+ . create_consumer ( "Dog" )
358
+ . create_consumer_version ( "40" )
359
+ . create_pact
360
+ . create_verification ( provider_version : "2" )
361
+ end
362
+
363
+ let ( :selector_1 ) { { pacticipant_name : "Bar" , pacticipant_version_number : "2" } }
364
+ let ( :selector_2 ) { { pacticipant_name : "Foo" , tag : "prod" } }
365
+ let ( :selectors ) { [ selector_1 , selector_2 ] }
366
+
367
+ subject { Service . find ( selectors , options ) }
368
+
369
+ context "with inferred selectors" do
370
+ let ( :options ) { { latest : true , tag : "prod" } }
371
+
372
+ it "determines the number of integrations" do
373
+ expect ( subject . integrations . size ) . to eq 3
374
+ end
375
+
376
+ it "finds all prod versions of Foo" do
377
+ expect ( subject . select { |row | row . consumer_name == "Foo" } . size ) . to eq 2
378
+ end
379
+
380
+ it "finds the single prod version of Cat" do
381
+ expect ( subject . select { |row | row . consumer_name == "Cat" } . size ) . to eq 1
382
+ end
383
+
384
+ it "is not deployable because of the missing verification for Cat v20" do
385
+ expect ( subject . deployment_status_summary . reasons . size ) . to eq 1
386
+ expect ( subject . deployment_status_summary . reasons . first ) . to be_a_pact_never_verified_for_consumer "Cat"
387
+ end
388
+ end
389
+
390
+ context "without inferred selectors" do
391
+ let ( :options ) { { } }
392
+
393
+ it "is deployable" do
394
+ expect ( subject . deployment_status_summary ) . to be_deployable
395
+ end
396
+ end
397
+ end
334
398
end
335
399
end
336
400
end
0 commit comments