Skip to content

Instantly share code, notes, and snippets.

@jwieringa
Last active March 26, 2017 21:24
Show Gist options
  • Save jwieringa/acbecf7ea791f4ba41315947bc770053 to your computer and use it in GitHub Desktop.
Save jwieringa/acbecf7ea791f4ba41315947bc770053 to your computer and use it in GitHub Desktop.
Trying out Rspec style test via Golang in Ginkgo/Gomega
package resource_proxy_integration
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"log"
"net/http"
"testing"
)
func TestResourceProxy(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Resource Proxy")
}
func get(path string) *http.Response {
resp, err := http.Get("http://opendata.arcgis.com/" + path)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
return resp
}
var _ = Describe("Resource Proxy", func() {
It("it should return 200", func() {
resp := get("datasets")
Expect(resp.Status).To(Equal("200 OK"))
})
// This spec is an example of a failure
It("it should return 200", func() {
resp := get("datasets")
Expect(resp.Status).To(Equal("404"))
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment