Skip to content

Commit

Permalink
add has release
Browse files Browse the repository at this point in the history
  • Loading branch information
lnguyen committed Jul 20, 2016
1 parent c53f532 commit b6645a8
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
11 changes: 11 additions & 0 deletions deployment.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package gogobosh

// HasRelease if deployment has release
func (d *Deployment) HasRelease(name string) bool {
for _, release := range d.Releases {
if release.Name == name {
return true
}
}
return false
}
28 changes: 28 additions & 0 deletions deployment_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package gogobosh_test

import (
. "github.com/cloudfoundry-community/gogobosh"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)

var _ = Describe("Deployment", func() {
Describe("Test Deployment", func() {

Describe("Test if release exist", func() {

It("see if release exist", func() {
deployment := &Deployment{
Releases: []Resource{
Resource{
Name: "test",
},
},
}
Expect(deployment.HasRelease("test")).Should(Equal(true))
Expect(deployment.HasRelease("bad")).Should(Equal(false))
})
})

})
})

0 comments on commit b6645a8

Please sign in to comment.