Esempio n. 1
0
func (s *S) TestNewBareShouldNotPassTemplateOptionWhenItsNotSetInConfig(c *gocheck.C) {
	config.Unset("git:bare:template")
	bareLocation, err := config.GetString("git:bare:location")
	c.Assert(err, gocheck.IsNil)
	barePath := path.Join(bareLocation, "foo.git")
	dir, err := commandmocker.Add("git", "$*")
	c.Assert(err, gocheck.IsNil)
	defer commandmocker.Remove(dir)
	err = newBare("foo")
	c.Assert(err, gocheck.IsNil)
	c.Assert(commandmocker.Ran(dir), gocheck.Equals, true)
	expected := fmt.Sprintf("init %s --bare", barePath)
	c.Assert(commandmocker.Output(dir), gocheck.Equals, expected)
}
Esempio n. 2
0
func (s *S) TestNewBareShouldPassTemplateOptionWhenItExistsOnConfig(c *check.C) {
	bareTemplate := "/var/templates"
	bareLocation, err := config.GetString("git:bare:location")
	config.Set("git:bare:template", bareTemplate)
	defer config.Unset("git:bare:template")
	barePath := path.Join(bareLocation, "foo.git")
	dir, err := commandmocker.Add("git", "$*")
	c.Assert(err, check.IsNil)
	defer commandmocker.Remove(dir)
	err = newBare("foo")
	c.Assert(err, check.IsNil)
	c.Assert(commandmocker.Ran(dir), check.Equals, true)
	expected := fmt.Sprintf("init %s --bare --template=%s", barePath, bareTemplate)
	c.Assert(commandmocker.Output(dir), check.Equals, expected)
}