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