From 9b77017aaf6db869f14b17847925d50c81dfd1f0 Mon Sep 17 00:00:00 2001 From: zachgersh Date: Tue, 4 Aug 2015 22:20:37 -0700 Subject: [PATCH] It's never pointers --- in_command.go | 3 ++- in_command_test.go | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/in_command.go b/in_command.go index 033901b..17743f9 100644 --- a/in_command.go +++ b/in_command.go @@ -95,7 +95,8 @@ func (c *InCommand) Run(destDir string, request InRequest) (InResponse, error) { fmt.Fprintf(c.writer, "downloading asset: %s\n", *asset.Name) - err := c.downloadFile(&asset, path) + assetToDownload := asset + err := c.downloadFile(&assetToDownload, path) if err != nil { return InResponse{}, err } diff --git a/in_command_test.go b/in_command_test.go index 3dfd946..7d49b3f 100644 --- a/in_command_test.go +++ b/in_command_test.go @@ -108,7 +108,9 @@ var _ = Describe("In Command", func() { )) }) - PIt("downloads only the files that match the globs", func() { + It("downloads only the files that match the globs", func() { + Ω(*githubClient.DownloadReleaseAssetArgsForCall(0)).Should(Equal(buildAsset(0, "example.txt"))) + Ω(*githubClient.DownloadReleaseAssetArgsForCall(1)).Should(Equal(buildAsset(1, "example.rtf"))) }) }) @@ -148,7 +150,10 @@ var _ = Describe("In Command", func() { )) }) - PIt("downloads all of the files", func() { + It("downloads all of the files", func() { + Ω(*githubClient.DownloadReleaseAssetArgsForCall(0)).Should(Equal(buildAsset(0, "example.txt"))) + Ω(*githubClient.DownloadReleaseAssetArgsForCall(1)).Should(Equal(buildAsset(1, "example.rtf"))) + Ω(*githubClient.DownloadReleaseAssetArgsForCall(2)).Should(Equal(buildAsset(2, "example.wtf"))) }) }) @@ -181,6 +186,10 @@ var _ = Describe("In Command", func() { BeforeEach(func() { githubClient.LatestReleaseReturns(buildRelease(1, "v0.37.0"), nil) + githubClient.ListReleaseAssetsReturns([]github.ReleaseAsset{ + buildAsset(0, "something.tgz"), + }, nil) + inRequest.Version = nil inResponse, inErr = command.Run(destDir, inRequest) }) @@ -222,7 +231,8 @@ var _ = Describe("In Command", func() { Ω(string(version)).Should(Equal("0.37.0")) }) - PIt("fetches from the latest release", func() { + It("fetches from the latest release", func() { + Ω(*githubClient.DownloadReleaseAssetArgsForCall(0)).Should(Equal(buildAsset(0, "something.tgz"))) }) }) })