travis-web/assets/scripts/spec/unit/build_spec.coffee
Piotr Sarnacki dff93c93fe Don't require some of the attributes for incomplete records
When build or job is not finished, we don't need to load the record
because of them, they will be loaded when 'finished' events come in.
2012-10-31 16:10:42 +01:00

31 lines
815 B
CoffeeScript

store = null
record = null
describe 'Travis.Build', ->
beforeEach ->
store = Travis.Store.create()
afterEach ->
store.destroy()
describe 'incomplete attributes', ->
beforeEach ->
record = store.loadIncomplete Travis.Build, { id: 1, state: 'started' }
it 'does not load record on duration, finishedAt and result if job is not in finished state', ->
record.get('_duration')
record.get('finishedAt')
record.get('result')
waits 50
runs ->
expect( record.get('complete') ).toBeFalsy()
it 'loads the rest of the record if it\'s in finished state', ->
record = store.loadIncomplete Travis.Build, { id: 1, state: 'finished' }
record.get('finishedAt')
waits 50
runs ->
expect( record.get('complete') ).toBeTruthy()