(t *testing.T)
| 2702 | } |
| 2703 | |
| 2704 | func TestNoRepoCanBeDetermined(t *testing.T) { |
| 2705 | // Given no head repo can be determined from git config |
| 2706 | cs, cmdTeardown := run.Stub() |
| 2707 | defer cmdTeardown(t) |
| 2708 | |
| 2709 | cs.Register(`git status --porcelain`, 0, "") |
| 2710 | cs.Register(`git config --get-regexp \^branch\\\..+\\\.\(remote\|merge\|pushremote\|gh-merge-base\)\$`, 0, "") |
| 2711 | cs.Register(`git rev-parse --symbolic-full-name feature@{push}`, 1, "") |
| 2712 | cs.Register("git config remote.pushDefault", 1, "") |
| 2713 | cs.Register("git config push.default", 1, "") |
| 2714 | |
| 2715 | // And Given there is no remote on the correct SHA |
| 2716 | cs.Register(`git show-ref --verify -- HEAD refs/remotes/origin/feature`, 0, heredoc.Doc(` |
| 2717 | deadbeef HEAD |
| 2718 | deadb00f refs/remotes/origin/feature`)) |
| 2719 | |
| 2720 | // When the command is run with no TTY |
| 2721 | reg := &httpmock.Registry{} |
| 2722 | reg.StubRepoInfoResponse("OWNER", "REPO", "master") |
| 2723 | defer reg.Verify(t) |
| 2724 | |
| 2725 | ios, _, _, stderr := iostreams.Test() |
| 2726 | |
| 2727 | opts := CreateOptions{ |
| 2728 | HttpClient: func() (*http.Client, error) { |
| 2729 | return &http.Client{Transport: reg}, nil |
| 2730 | }, |
| 2731 | Config: func() (gh.Config, error) { |
| 2732 | return config.NewMockConfig(), nil |
| 2733 | }, |
| 2734 | Browser: &browser.Stub{}, |
| 2735 | IO: ios, |
| 2736 | Prompter: &prompter.PrompterMock{}, |
| 2737 | GitClient: &git.Client{ |
| 2738 | GhPath: "some/path/gh", |
| 2739 | GitPath: "some/path/git", |
| 2740 | }, |
| 2741 | Finder: shared.NewMockFinder("feature", nil, nil), |
| 2742 | Remotes: func() (context.Remotes, error) { |
| 2743 | return context.Remotes{ |
| 2744 | { |
| 2745 | Remote: &git.Remote{ |
| 2746 | Name: "origin", |
| 2747 | Resolved: "base", |
| 2748 | }, |
| 2749 | Repo: ghrepo.New("OWNER", "REPO"), |
| 2750 | }, |
| 2751 | }, nil |
| 2752 | }, |
| 2753 | Branch: func() (string, error) { |
| 2754 | return "feature", nil |
| 2755 | }, |
| 2756 | |
| 2757 | TitleProvided: true, |
| 2758 | BodyProvided: true, |
| 2759 | Title: "my title", |
| 2760 | Body: "my body", |
| 2761 | } |
nothing calls this directly
no test coverage detected