Make tests for BuildWithEnvironment clearer
diff --git a/gexec/build_test.go b/gexec/build_test.go index a2f1ccd..c090339 100644 --- a/gexec/build_test.go +++ b/gexec/build_test.go
@@ -40,28 +40,20 @@ var _ = Describe(".BuildWithEnvironment", func() { var err error + env := map[string]string{ + "GOOS": "linux", + "GOARCH": "amd64", + } It("compiles the specified package with the specified env vars", func() { - env := map[string]string{ - "GOOS": "linux", - "GOARCH": "amd64", - } - compiledPath, err := gexec.BuildWithEnvironment(packagePath, env) Ω(err).ShouldNot(HaveOccurred()) Ω(compiledPath).Should(BeAnExistingFile()) }) It("returns the environment to a good state", func() { - knownGoodEnv := os.Environ() - - env := map[string]string{ - "THIS_ENV_VAR": "SHOULD_NOT_BE_SET", - } - _, err = gexec.BuildWithEnvironment(packagePath, env) Ω(err).ShouldNot(HaveOccurred()) - - Ω(os.Environ()).Should(Equal(knownGoodEnv)) + Ω(os.Environ()).ShouldNot(ContainElement("GOOS=linux")) }) })