Fix specs

This commit is contained in:
Piotr Sarnacki 2014-07-15 13:23:01 +02:00
parent 68b7357375
commit 2677f3f613
7 changed files with 12 additions and 12 deletions

View File

@ -55,7 +55,7 @@ unless window.TravisApplication
type = Ember.get(Travis, 'mappings')[name] type = Ember.get(Travis, 'mappings')[name]
if name == 'build' && data.build.commit if name == 'build' && data.build?.commit
# TODO: commit should be a sideload record on build, not mixed with it # TODO: commit should be a sideload record on build, not mixed with it
build = data.build build = data.build
commit = { commit = {

View File

@ -86,7 +86,7 @@ require 'travis/model'
Travis.ajax.post "/builds/#{@get('id')}/restart" Travis.ajax.post "/builds/#{@get('id')}/restart"
isPropertyLoaded: (key) -> isPropertyLoaded: (key) ->
if ['_duration', 'finishedAt'].contains(key) && !@get('isFinished') if ['_duration', '_finishedAt'].contains(key) && !@get('isFinished')
return true return true
else else
@_super(key) @_super(key)

View File

@ -107,9 +107,9 @@ require 'travis/model'
).observes('state') ).observes('state')
isPropertyLoaded: (key) -> isPropertyLoaded: (key) ->
if ['finishedAt'].contains(key) && !@get('isFinished') if ['_finishedAt'].contains(key) && !@get('isFinished')
return true return true
else if key == 'startedAt' && @get('state') == 'created' else if key == '_startedAt' && @get('state') == 'created'
return true return true
else else
@_super(key) @_super(key)

View File

@ -8,14 +8,14 @@
</div> </div>
<div class="runtime"> <div class="runtime">
{{#if build.isFinished}}ran{{else}}running{{/if}} for {{formatDuration build.duration}} {{#if build.isFinished}}ran{{else}}running{{/if}} for {{formatDuration build.duration}}
</div> </div>
<div class="finished"> <div class="finished">
{{formatTime build.finishedAt}} {{formatTime build.finishedAt}}
</div> </div>
</div> </div>
<div class="branch" {{bind-attr title="build.commit.branch"}}> <div class="branch" {{bind-attr title="build.commit.branch"}}>
{{build.commit.branch}} {{build.commit.branch}}
</div> </div>

View File

@ -24,7 +24,7 @@ test "my repos is active by default when user is signed in", ->
branch: 'master' branch: 'master'
compare: '0123456..4567890' compare: '0123456..4567890'
finishedAt: '-' finishedAt: '-'
duration: '1 min' duration: '-'
message: 'commit message 4' message: 'commit message 4'
test "my repos is activated when user signs in", -> test "my repos is activated when user signs in", ->

View File

@ -7,7 +7,7 @@ module "Travis.Build",
Travis.Job.resetData() Travis.Job.resetData()
test 'it does not load record on duration, finishedAt and result if job is not in finished state', -> test 'it does not load record on duration, finishedAt and result if job is not in finished state', ->
Travis.Build.load [{ id: 1, state: 'started' }] Travis.Build.load [{ id: 1, state: 'started', started_at: null }]
Ember.run -> Ember.run ->
record = Travis.Build.find 1 record = Travis.Build.find 1
@ -15,7 +15,7 @@ test 'it does not load record on duration, finishedAt and result if job is not i
record.loadTheRest = -> record.loadTheRest = ->
ok(false, 'loadTheRest should not be called') ok(false, 'loadTheRest should not be called')
record.get('_duration') record.get('duration')
record.get('finishedAt') record.get('finishedAt')
record.get('result') record.get('result')
@ -25,7 +25,7 @@ test 'it does not load record on duration, finishedAt and result if job is not i
test 'it loads record on duration, finishedAt and result if job is in finished state', -> test 'it loads record on duration, finishedAt and result if job is in finished state', ->
expect(1) expect(1)
Travis.Build.load [{ id: 1, state: 'passed' }] Travis.Build.load [{ id: 1, state: 'passed', started_at: null }]
Ember.run -> Ember.run ->
record = Travis.Build.find 1 record = Travis.Build.find 1

View File

@ -37,7 +37,7 @@ test 'configKeys takes into account the keys of other jobs', ->
deepEqual( configValues3, [ '1.9.3', undefined, undefined, 'OpenJDK' ] ) deepEqual( configValues3, [ '1.9.3', undefined, undefined, 'OpenJDK' ] )
test 'it does not load record on duration, finishedAt and result if job is not in finished state', -> test 'it does not load record on duration, finishedAt and result if job is not in finished state', ->
Travis.Job.load [{ id: 1, state: 'started' }] Travis.Job.load [{ id: 1, state: 'started', started_at: null }]
Ember.run -> Ember.run ->
record = Travis.Job.find 1 record = Travis.Job.find 1
@ -55,7 +55,7 @@ test 'it does not load record on duration, finishedAt and result if job is not i
test 'it loads record on duration, finishedAt and result if job is in finished state', -> test 'it loads record on duration, finishedAt and result if job is in finished state', ->
expect(1) expect(1)
Travis.Job.load [{ id: 1, state: 'passed' }] Travis.Job.load [{ id: 1, state: 'passed', started_at: null }]
Ember.run -> Ember.run ->
record = Travis.Job.find 1 record = Travis.Job.find 1