task-master
Version:
A helper to make Grunt task declaration and organization cleaner.
53 lines (48 loc) • 2.06 kB
text/coffeescript
describe 'task-master', ->
Given -> = process.cwd()
Given -> = {}
Given -> = spyObj 'buildOpts', 'buildConfig'
Given -> = spyObj 'load', 'init', 'alias'
Given -> = sinon.stub()
Given -> =
'./builder':
'file-manifest':
'./grunt':
'jit-grunt':
Given -> ["#{@root}/package"] = 'pkg'
Given -> = sandbox '../lib/task-master',
Given -> = spyObj 'initConfig'
context 'no jit options', ->
Given -> = {}
Given -> .buildOpts.withArgs(, ).returns 'options'
Given -> .buildConfig.withArgs(, 'options', ).returns 'config'
When -> ,
Then -> expect().to.have.been.calledWith
And -> expect(.alias).to.have.been.calledWith 'options',
And -> expect(.initConfig).to.have.been.calledWith 'config'
context 'jit options', ->
Given -> = {}
Given -> .buildOpts.withArgs(, ).returns
jit:
foo: 'bar'
Given -> .buildConfig.withArgs(,
jit:
foo: 'bar'
, ).returns 'config'
When -> ,
Then -> expect().to.have.been.calledWith , { foo: 'bar' }
And -> expect(.alias).to.have.been.calledWith
jit:
foo: 'bar'
,
And -> expect(.initConfig).to.have.been.calledWith 'config'
context 'jit is false', ->
Given -> = {}
Given -> .buildOpts.withArgs(, ).returns
jit: false
Given -> .buildConfig.withArgs(, { jit: false }, ).returns 'config'
When -> ,
Then -> expect(.called).to.be.false()
And -> expect(.load).to.have.been.calledWith 'pkg', { jit: false },
And -> expect(.alias).to.have.been.calledWith { jit: false },
And -> expect(.initConfig).to.have.been.calledWith 'config'