@@ -10,7 +10,25 @@ module Webhooks
10
10
end
11
11
12
12
let ( :pact ) do
13
- instance_double ( "pact" , consumer_version_number : "1.2.3+foo" , consumer_name : "Foo" , provider_name : "Bar" )
13
+ instance_double ( "pact" , consumer_version_number : "1.2.3+foo" , consumer_name : "Foo" , provider_name : "Bar" , latest_verification : nil )
14
+ end
15
+
16
+ let ( :pact_with_no_verification ) { pact }
17
+
18
+ let ( :pact_with_successful_verification ) do
19
+ instance_double ( "pact" ,
20
+ consumer_version_number : "1.2.3+foo" ,
21
+ consumer_name : "Foo" ,
22
+ provider_name : "Bar" ,
23
+ latest_verification : verification )
24
+ end
25
+
26
+ let ( :pact_with_failed_verification ) do
27
+ instance_double ( "pact" ,
28
+ consumer_version_number : "1.2.3+foo" ,
29
+ consumer_name : "Foo" ,
30
+ provider_name : "Bar" ,
31
+ latest_verification : failed_verification )
14
32
end
15
33
16
34
let ( :verification ) do
@@ -21,6 +39,7 @@ module Webhooks
21
39
instance_double ( "verification" , provider_version_number : "3" , success : false )
22
40
end
23
41
42
+ let ( :nil_pact ) { nil }
24
43
let ( :nil_verification ) { nil }
25
44
26
45
subject { Render . call ( template , pact , verification ) }
@@ -34,7 +53,10 @@ module Webhooks
34
53
[ "${pactbroker.providerName}" , "Bar" , :pact , :verification ] ,
35
54
[ "${pactbroker.githubVerificationStatus}" , "success" , :pact , :verification ] ,
36
55
[ "${pactbroker.githubVerificationStatus}" , "failure" , :pact , :failed_verification ] ,
37
- [ "${pactbroker.githubVerificationStatus}" , "" , :pact , :nil_verification ]
56
+ [ "${pactbroker.githubVerificationStatus}" , "" , :nil_pact , :nil_verification ] ,
57
+ [ "${pactbroker.githubVerificationStatus}" , "pending" , :pact_with_no_verification , :nil_verification ] ,
58
+ [ "${pactbroker.githubVerificationStatus}" , "success" , :pact_with_successful_verification , :nil_verification ] ,
59
+ [ "${pactbroker.githubVerificationStatus}" , "failure" , :pact_with_failed_verification , :nil_verification ]
38
60
]
39
61
40
62
TEST_CASES . each do | ( template , expected_output , pact_var_name , verification_var_name ) |
0 commit comments