It's never pointers

This commit is contained in:
zachgersh
2015-08-04 22:20:37 -07:00
parent 65650bf3ea
commit 9b77017aaf
2 changed files with 15 additions and 4 deletions

View File

@@ -95,7 +95,8 @@ func (c *InCommand) Run(destDir string, request InRequest) (InResponse, error) {
fmt.Fprintf(c.writer, "downloading asset: %s\n", *asset.Name) 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 { if err != nil {
return InResponse{}, err return InResponse{}, err
} }

View File

@@ -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() { BeforeEach(func() {
githubClient.LatestReleaseReturns(buildRelease(1, "v0.37.0"), nil) githubClient.LatestReleaseReturns(buildRelease(1, "v0.37.0"), nil)
githubClient.ListReleaseAssetsReturns([]github.ReleaseAsset{
buildAsset(0, "something.tgz"),
}, nil)
inRequest.Version = nil inRequest.Version = nil
inResponse, inErr = command.Run(destDir, inRequest) inResponse, inErr = command.Run(destDir, inRequest)
}) })
@@ -222,7 +231,8 @@ var _ = Describe("In Command", func() {
Ω(string(version)).Should(Equal("0.37.0")) Ω(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")))
}) })
}) })
}) })