💄 Add helper to set spec field on all specs

This commit is contained in:
Kevin Sawicki
2013-10-14 11:22:34 -07:00
parent 0b22d99fad
commit ec37b8abd9

View File

@@ -8,23 +8,25 @@ measure 'spec suite require time', ->
require specFilePath
# Set spec directory on spec for setting up the project in spec-helper
specs = jasmine.getEnv().currentRunner().specs()
if specs.length > 0
for index in [specs.length-1..0]
break if specs[index].specDirectory?
specs[index].specDirectory = specDirectory
setSpecDirectory(specDirectory)
setSpecType = (specType) ->
setSpecField = (name, value) ->
specs = jasmine.getEnv().currentRunner().specs()
return if specs.length is 0
for index in [specs.length-1..0]
break if specs[index].specType?
specs[index].specType = specType
break if specs[index][name]?
specs[index][name] = value
setSpecType = (specType) ->
setSpecField('specType', specType)
setSpecDirectory = (specDirectory) ->
setSpecField('specDirectory', specDirectory)
runAllSpecs = ->
# Only run core specs when resource path is the Atom repository
if Git.exists(window.resourcePath)
# requireSpecs(path.join(window.resourcePath, 'spec'))
requireSpecs(path.join(window.resourcePath, 'spec'))
setSpecType('core')
fixturesPackagesPath = path.join(__dirname, 'fixtures', 'packages')