fix handling of redirect from asset download

This commit is contained in:
Alex Suraci
2016-07-09 18:32:35 -07:00
parent 12003714cf
commit 3a7443448e
72 changed files with 10743 additions and 680 deletions

View File

@@ -10,6 +10,7 @@ type Specs struct {
specs []*Spec
numberOfOriginalSpecs int
hasProgrammaticFocus bool
RegexScansFilePath bool
}
func NewSpecs(specs []*Spec) *Specs {
@@ -45,7 +46,7 @@ func (e *Specs) ApplyFocus(description string, focusString string, skipString st
if focusString == "" && skipString == "" {
e.applyProgrammaticFocus()
} else {
e.applyRegExpFocus(description, focusString, skipString)
e.applyRegExpFocusAndSkip(description, focusString, skipString)
}
}
@@ -67,12 +68,27 @@ func (e *Specs) applyProgrammaticFocus() {
}
}
func (e *Specs) applyRegExpFocus(description string, focusString string, skipString string) {
// toMatch returns a byte[] to be used by regex matchers. When adding new behaviours to the matching function,
// this is the place which we append to.
func (e *Specs) toMatch(description string, spec *Spec) []byte {
if e.RegexScansFilePath {
return []byte(
description + " " +
spec.ConcatenatedString() + " " +
spec.subject.CodeLocation().FileName)
} else {
return []byte(
description + " " +
spec.ConcatenatedString())
}
}
func (e *Specs) applyRegExpFocusAndSkip(description string, focusString string, skipString string) {
for _, spec := range e.specs {
matchesFocus := true
matchesSkip := false
toMatch := []byte(description + " " + spec.ConcatenatedString())
toMatch := e.toMatch(description, spec)
if focusString != "" {
focusFilter := regexp.MustCompile(focusString)

View File

@@ -71,6 +71,7 @@ func (suite *Suite) generateSpecs(description string, config config.GinkgoConfig
}
specs := spec.NewSpecs(specsSlice)
specs.RegexScansFilePath = config.RegexScansFilePath
if config.RandomizeAllSpecs {
specs.Shuffle(rand.New(rand.NewSource(config.RandomSeed)))
@@ -85,7 +86,6 @@ func (suite *Suite) generateSpecs(description string, config config.GinkgoConfig
if config.ParallelTotal > 1 {
specs.TrimForParallelization(config.ParallelTotal, config.ParallelNode)
}
return specs
}