1package commands
2
3import (
4	"testing"
5
6	"github.com/bmizerany/assert"
7	"github.com/github/hub/github"
8)
9
10func TestPullRequest_ParsePullRequestProject(t *testing.T) {
11	c := &github.Project{Host: "github.com", Owner: "jingweno", Name: "gh"}
12
13	s := "develop"
14	p, ref := parsePullRequestProject(c, s)
15	assert.Equal(t, "develop", ref)
16	assert.Equal(t, "github.com", p.Host)
17	assert.Equal(t, "jingweno", p.Owner)
18	assert.Equal(t, "gh", p.Name)
19
20	s = "mojombo:develop"
21	p, ref = parsePullRequestProject(c, s)
22	assert.Equal(t, "develop", ref)
23	assert.Equal(t, "github.com", p.Host)
24	assert.Equal(t, "mojombo", p.Owner)
25	assert.Equal(t, "gh", p.Name)
26
27	s = "mojombo/jekyll:develop"
28	p, ref = parsePullRequestProject(c, s)
29	assert.Equal(t, "develop", ref)
30	assert.Equal(t, "github.com", p.Host)
31	assert.Equal(t, "mojombo", p.Owner)
32	assert.Equal(t, "jekyll", p.Name)
33}
34