Exemplo n.º 1
0
								Name: "space-name-1",
							},
						},
						{
							SpaceFields: models.SpaceFields{
								GUID: "space-guid-2",
								Name: "space-name-2",
							},
						},
					}

					fakeSpaceRepo.ListSpacesFromOrgStub = func(orgGUID string, callback func(models.Space) bool) error {
						Expect(orgGUID).To(Equal(org.GUID))

						for _, space := range spaces {
							Expect(callback(space)).To(BeTrue())
						}

						return nil
					}
				})

				It("binds the security group to all of the org's spaces", func() {
					runCommand("sec group", "org")

					Expect(fakeSpaceRepo.ListSpacesFromOrgCallCount()).Should(Equal(1))
					Expect(fakeSpaceBinder.BindSpaceCallCount()).Should(Equal(2))

					for i, space := range spaces {
						securityGroupGUID, spaceGUID := fakeSpaceBinder.BindSpaceArgsForCall(i)
						Expect(securityGroupGUID).To(Equal(securityGroup.GUID))