func newDraftRepositoryRelease(id int, version string) github.RepositoryRelease { return github.RepositoryRelease{ TagName: github.String(version), Draft: github.Bool(true), ID: github.Int(id), } }
request resource.OutRequest response resource.OutResponse ) BeforeEach(func() { var err error githubClient = &fakes.FakeGitHub{} command = resource.NewOutCommand(githubClient, ioutil.Discard) sourcesDir, err = ioutil.TempDir("", "github-release") Ω(err).ShouldNot(HaveOccurred()) githubClient.CreateReleaseStub = func(gh github.RepositoryRelease) (*github.RepositoryRelease, error) { createdRel := gh createdRel.ID = github.Int(112) createdRel.HTMLURL = github.String("http://google.com") createdRel.Name = github.String("release-name") createdRel.Body = github.String("*markdown*") return &createdRel, nil } githubClient.UpdateReleaseStub = func(gh github.RepositoryRelease) (*github.RepositoryRelease, error) { return &gh, nil } }) JustBeforeEach(func() { var err error response, err = command.Run(sourcesDir, request) Ω(err).ShouldNot(HaveOccurred())
Ω(err).ShouldNot(HaveOccurred()) destDir = filepath.Join(tmpDir, "destination") githubClient.DownloadReleaseAssetReturns(ioutil.NopCloser(bytes.NewBufferString("some-content")), nil) inRequest = resource.InRequest{} }) AfterEach(func() { Ω(os.RemoveAll(tmpDir)).Should(Succeed()) }) buildRelease := func(id int, tag string) *github.RepositoryRelease { return &github.RepositoryRelease{ ID: github.Int(id), TagName: github.String(tag), HTMLURL: github.String("http://google.com"), Name: github.String("release-name"), Body: github.String("*markdown*"), } } buildAsset := func(id int, name string) github.ReleaseAsset { return github.ReleaseAsset{ ID: github.Int(id), Name: &name, } } Context("when there is a tagged release", func() {
func newDraftWithNilTagRepositoryRelease(id int) github.RepositoryRelease { return github.RepositoryRelease{ Draft: github.Bool(true), ID: github.Int(id), } }