Skip to content

Commit

Permalink
Adds gauge_concepts_dir for defining concepts directory
Browse files Browse the repository at this point in the history
Signed-off-by: Haroon Sheikh <[email protected]>
Signed-off-by: Haroon Sheikh <[email protected]>
  • Loading branch information
haroon-sheikh committed Jul 20, 2023
1 parent 2a8cb81 commit 462fee4
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions util/fileUtils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,29 @@ func (s *MySuite) TestGetConceptFilesWhenSpecDirIsWithInProject(c *C) {
c.Assert(len(GetConceptFiles()), Equals, 2)
}

func (s *MySuite) TestGetConceptFilesWhenConceptsDirSet(c *C) {
os.Clearenv()
config.ProjectRoot = "_testdata/specs"
c.Assert(len(GetConceptFiles()), Equals, 2)

config.ProjectRoot = "_testdata"
os.Setenv(env.ConceptsDir, filepath.Join("_testdata", "specs", "concept1.cpt"))
c.Assert(len(GetConceptFiles()), Equals, 1)

os.Setenv(env.ConceptsDir, filepath.Join("_testdata", "specs", "subdir"))
c.Assert(len(GetConceptFiles()), Equals, 1)

os.Setenv(env.ConceptsDir, filepath.Join("_testdata", "specs", "subdir", "concept2.cpt"))
c.Assert(len(GetConceptFiles()), Equals, 1)
}

func (s *MySuite) TestGetConceptFilesWhenConceptDirIsOutsideProjectRoot(c *C) {
os.Clearenv()
config.ProjectRoot = "_testdata"
os.Setenv(env.ConceptsDir, "_testSpecDir,_testdata/specs")
c.Assert(len(GetConceptFiles()), Equals, 3)
}

func (s *MySuite) TestFindAllNestedDirs(c *C) {
nested1 := filepath.Join(dir, "nested")
nested2 := filepath.Join(dir, "nested2")
Expand Down

0 comments on commit 462fee4

Please sign in to comment.