travis-web/assets/scripts/spec/unit/job_spec.coffee
Piotr Sarnacki af00392d15 Fix jobs table when jobs have different config keys
If we have 2 jobs within 1 build, with such config values:

    { rvm: 'jruby-head', jdk: 'oraclejdk7' }
    { rvm: '1.9.3', jdk: null }

We should return jdk in configValues for second build, even if it's not
present. Otherwise table rows may be missing.

(closes #28)
2012-10-20 02:14:17 +02:00

45 lines
1019 B
CoffeeScript

store = null
describe 'Travis.Job', ->
beforeEach ->
store = Travis.Store.create()
afterEach ->
store.destroy()
describe 'with different number of config keys in sibling jobs', ->
beforeEach ->
buildAttrs =
id: 1
job_ids: [1, 2]
config:
jdk: ['oraclejdk7']
rvm: ['jruby-head']
store.load Travis.Build, 1, buildAttrs
jobAttrs =
id: 1
build_id: 1
config:
jdk: 'oraclejdk7'
rvm: 'jruby-head'
store.load Travis.Job, 1, jobAttrs
jobAttrs =
id: 2
build_id: 1
config:
jdk: null
rvm: 'jruby-head'
store.load Travis.Job, 2, jobAttrs
it 'returns config values for all keys available on build', ->
job1 = store.find Travis.Job, 1
job2 = store.find Travis.Job, 2
expect( job1.get('configValues') ).toEqual ['oraclejdk7', 'jruby-head']
expect( job2.get('configValues') ).toEqual [undefined, 'jruby-head']