@@ -453,9 +453,15 @@ var _ = Describe("Service Broker API", func() {
453
453
}
454
454
455
455
Describe ("binding" , func () {
456
- var details * brokerapi.BindDetails
456
+ var (
457
+ instanceID string
458
+ bindingID string
459
+ details * brokerapi.BindDetails
460
+ )
457
461
458
462
BeforeEach (func () {
463
+ instanceID = uniqueInstanceID ()
464
+ bindingID = uniqueBindingID ()
459
465
details = & brokerapi.BindDetails {
460
466
AppGUID : "app_guid" ,
461
467
PlanID : "plan_id" ,
@@ -465,8 +471,6 @@ var _ = Describe("Service Broker API", func() {
465
471
466
472
Context ("when the associated instance exists" , func () {
467
473
It ("calls Bind on the service broker with the instance and binding ids" , func () {
468
- instanceID := uniqueInstanceID ()
469
- bindingID := uniqueBindingID ()
470
474
makeBindingRequest (instanceID , bindingID , details )
471
475
Expect (fakeServiceBroker .BoundInstanceIDs ).To (ContainElement (instanceID ))
472
476
Expect (fakeServiceBroker .BoundBindingIDs ).To (ContainElement (bindingID ))
@@ -489,6 +493,26 @@ var _ = Describe("Service Broker API", func() {
489
493
Expect (response .StatusCode ).To (Equal (422 ))
490
494
})
491
495
})
496
+
497
+ Context ("when there are arbitrary params" , func () {
498
+ BeforeEach (func () {
499
+ details .Parameters = map [string ]interface {}{
500
+ "string" : "some-string" ,
501
+ "number" : 1 ,
502
+ "object" : struct { Name string }{"some-name" },
503
+ "array" : []interface {}{"a" , "b" , "c" },
504
+ }
505
+ })
506
+
507
+ It ("calls Bind on the service broker with all params" , func () {
508
+ makeBindingRequest (instanceID , bindingID , details )
509
+ Expect (fakeServiceBroker .BoundBindingDetails .Parameters ["string" ]).To (Equal ("some-string" ))
510
+ Expect (fakeServiceBroker .BoundBindingDetails .Parameters ["number" ]).To (Equal (1.0 ))
511
+ Expect (fakeServiceBroker .BoundBindingDetails .Parameters ["array" ]).To (Equal ([]interface {}{"a" , "b" , "c" }))
512
+ actual , _ := fakeServiceBroker .BoundBindingDetails .Parameters ["object" ].(map [string ]interface {})
513
+ Expect (actual ["Name" ]).To (Equal ("some-name" ))
514
+ })
515
+ })
492
516
})
493
517
494
518
Context ("when the associated instance does not exist" , func () {
0 commit comments