Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

fixtures: initialize fixtures into separated methods #214

Merged
merged 1 commit into from
Jan 19, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions fixtures/fixtures.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,20 +264,34 @@ func (g Fixtures) Exclude(tag string) Fixtures {
return r
}

type Suite struct{}

func (s *Suite) SetUpSuite(c *check.C) {
// Init set the correct path to be able to access to the fixtures files
func Init() {
RootFolder = filepath.Join(
build.Default.GOPATH,
"src", "gopkg.in/src-d/go-git.v4", "fixtures",
)
}

func (s *Suite) TearDownSuite(c *check.C) {
// Clean cleans all the temporal files created
func Clean() error {
for f := range folders {
err := os.RemoveAll(f)
c.Assert(err, check.IsNil)
if err != nil {
return err
}

delete(folders, f)
}

return nil
}

type Suite struct{}

func (s *Suite) SetUpSuite(c *check.C) {
Init()
}

func (s *Suite) TearDownSuite(c *check.C) {
c.Assert(Clean(), check.IsNil)
}