Fix the rest of the specs
This commit is contained in:
parent
712389efdb
commit
4337949dd4
|
@ -4,3 +4,15 @@ Travis.JobController = Em.Controller.extend
|
||||||
jobBinding: 'controllers.repo.job'
|
jobBinding: 'controllers.repo.job'
|
||||||
repoBinding: 'controllers.repo.repo'
|
repoBinding: 'controllers.repo.repo'
|
||||||
commitBinding: 'job.commit'
|
commitBinding: 'job.commit'
|
||||||
|
|
||||||
|
urlGithubCommit: (->
|
||||||
|
Travis.Urls.githubCommit(@get('repo.slug'), @get('commit.sha'))
|
||||||
|
).property('repo.slug', 'commit.sha')
|
||||||
|
|
||||||
|
urlAuthor: (->
|
||||||
|
Travis.Urls.email(@get('commit.authorEmail'))
|
||||||
|
).property('commit.authorEmail')
|
||||||
|
|
||||||
|
urlCommitter: (->
|
||||||
|
Travis.Urls.email(@get('commit.committerEmail'))
|
||||||
|
).property('commit.committerEmail')
|
||||||
|
|
|
@ -141,6 +141,7 @@ Travis.Store = DS.Store.extend
|
||||||
result = @merge(type, hash, true)
|
result = @merge(type, hash, true)
|
||||||
if result && result.clientId
|
if result && result.clientId
|
||||||
@addLoadedData(type, result.clientId, hash)
|
@addLoadedData(type, result.clientId, hash)
|
||||||
|
#@_updateRelationships(type, hash)
|
||||||
|
|
||||||
result
|
result
|
||||||
|
|
||||||
|
@ -158,3 +159,18 @@ Travis.Store = DS.Store.extend
|
||||||
root = type.pluralName()
|
root = type.pluralName()
|
||||||
@adapter.sideload(store, type, json, root)
|
@adapter.sideload(store, type, json, root)
|
||||||
@loadMany(type, json[root])
|
@loadMany(type, json[root])
|
||||||
|
|
||||||
|
_updateRelationships: (type, data) ->
|
||||||
|
Em.get(type, 'relationshipsByName').forEach (key, meta) =>
|
||||||
|
if meta.kind == 'belongsTo'
|
||||||
|
id = data["#{key}_id"]
|
||||||
|
if clientId = @typeMapFor(meta.type).idToCid[id]
|
||||||
|
if parent = this.findByClientId(meta.type, clientId, id)
|
||||||
|
dataProxy = parent.get('data')
|
||||||
|
if ids = dataProxy['hasMany'][type.pluralName()]
|
||||||
|
unless data.id in ids
|
||||||
|
state = parent.get('stateManager.currentState.path')
|
||||||
|
unless state == "rootState.loaded.materializing"
|
||||||
|
parent.send('materializingData')
|
||||||
|
ids.pushObject(data.id)
|
||||||
|
parent.notifyPropertyChange('data')
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
<dd class="duration" {{bindAttr title="startedAt"}}>{{formatDuration job.duration}}</dd>
|
<dd class="duration" {{bindAttr title="startedAt"}}>{{formatDuration job.duration}}</dd>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{#if commit}}
|
||||||
<div class="right">
|
<div class="right">
|
||||||
<dt>{{t jobs.commit}}</dt>
|
<dt>{{t jobs.commit}}</dt>
|
||||||
<dd class="commit"><a {{bindAttr href="urlGithubCommit"}}>{{formatCommit commit}}</a></dd>
|
<dd class="commit"><a {{bindAttr href="urlGithubCommit"}}>{{formatCommit commit}}</a></dd>
|
||||||
|
@ -35,6 +36,7 @@
|
||||||
<dd class="committer"><a {{bindAttr href="urlCommitter"}}>{{commit.committerName}}</a></dd>
|
<dd class="committer"><a {{bindAttr href="urlCommitter"}}>{{commit.committerName}}</a></dd>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
<dt>{{t jobs.message}}</dt>
|
<dt>{{t jobs.message}}</dt>
|
||||||
<dd class="message">{{formatMessage commit.message}}</dd>
|
<dd class="message">{{formatMessage commit.message}}</dd>
|
||||||
|
|
|
@ -42,14 +42,14 @@
|
||||||
# undefined key
|
# undefined key
|
||||||
return if !key || key == 'undefined'
|
return if !key || key == 'undefined'
|
||||||
|
|
||||||
message = "Load missing fields for #{@constructor.toString()} because of missing key '#{key}', cid: #{@get('clientId')}"
|
message = "Load missing fields for #{@constructor.toString()} because of missing key '#{key}', cid: #{@get('clientId')}, id: #{@get('id')}"
|
||||||
if @constructor.isAttribute('state') && key != 'state'
|
if @constructor.isAttribute('state') && key != 'state'
|
||||||
message += ", in state: #{@get('state')}"
|
message += ", in state: #{@get('state')}"
|
||||||
console.log message
|
console.log message
|
||||||
return if @get('isCompleting')
|
return if @get('isCompleting')
|
||||||
@set 'isCompleting', true
|
@set 'isCompleting', true
|
||||||
|
|
||||||
if @get('stateManager.currentState.path') != 'rootState.loaded.materializing'
|
unless @get('stateManager.currentState.path').match /^rootState.loaded.materializing/
|
||||||
@reload()
|
@reload()
|
||||||
@set 'incomplete', false
|
@set 'incomplete', false
|
||||||
|
|
||||||
|
|
|
@ -54,10 +54,9 @@ describe 'events', ->
|
||||||
started_at: '2012-07-02T00:02:00Z'
|
started_at: '2012-07-02T00:02:00Z'
|
||||||
finished_at: '2012-07-02T00:02:55Z'
|
finished_at: '2012-07-02T00:02:55Z'
|
||||||
event_type: 'push'
|
event_type: 'push'
|
||||||
result: 1
|
|
||||||
message: 'commit message 3'
|
message: 'commit message 3'
|
||||||
commit: '1234567'
|
commit: '1234567'
|
||||||
state: 'started'
|
state: 'failed'
|
||||||
|
|
||||||
Em.run ->
|
Em.run ->
|
||||||
Travis.receive 'build:started', payload
|
Travis.receive 'build:started', payload
|
||||||
|
@ -75,40 +74,6 @@ describe 'events', ->
|
||||||
runs ->
|
runs ->
|
||||||
waitFor queuesRendered
|
waitFor queuesRendered
|
||||||
|
|
||||||
it 'adds a job to the jobs matrix', ->
|
|
||||||
payload =
|
|
||||||
job:
|
|
||||||
id: 15
|
|
||||||
repository_id: 1
|
|
||||||
build_id: 1
|
|
||||||
commit_id: 1
|
|
||||||
log_id: 1
|
|
||||||
number: '1.4'
|
|
||||||
duration: 55
|
|
||||||
started_at: '2012-07-02T00:02:00Z'
|
|
||||||
finished_at: '2012-07-02T00:02:55Z'
|
|
||||||
config: { rvm: 'jruby' }
|
|
||||||
|
|
||||||
$.mockjax
|
|
||||||
url: '/jobs/15'
|
|
||||||
responseTime: 0
|
|
||||||
responseText: payload
|
|
||||||
|
|
||||||
Em.run ->
|
|
||||||
Travis.receive 'job:started',
|
|
||||||
job:
|
|
||||||
id: 15
|
|
||||||
repository_id: 1
|
|
||||||
build_id: 1
|
|
||||||
commit_id: 1
|
|
||||||
|
|
||||||
waits(100)
|
|
||||||
runs ->
|
|
||||||
listsJob
|
|
||||||
table: $('#jobs')
|
|
||||||
row: 3
|
|
||||||
item: { id: 15, number: '1.4', repo: 'travis-ci/travis-core', finishedAt: 'less than a minute ago', duration: '55 sec', rvm: 'jruby' }
|
|
||||||
|
|
||||||
it 'adds a job to the jobs queue', ->
|
it 'adds a job to the jobs queue', ->
|
||||||
payload =
|
payload =
|
||||||
job:
|
job:
|
||||||
|
@ -191,7 +156,7 @@ describe 'events', ->
|
||||||
app '/travis-ci/travis-core'
|
app '/travis-ci/travis-core'
|
||||||
waitFor workersRendered
|
waitFor workersRendered
|
||||||
|
|
||||||
it 'does not update repository if it\'s already in store', ->
|
it 'does not update repository if it\'s already in the store', ->
|
||||||
payload =
|
payload =
|
||||||
worker:
|
worker:
|
||||||
id: 1
|
id: 1
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
describe 'on the "job" state', ->
|
describe 'on the "job" state', ->
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
|
$.mockjax
|
||||||
|
url: '/jobs/1/log?cors_hax=true'
|
||||||
|
responseTime: 0
|
||||||
|
responseText: 'log 1'
|
||||||
|
|
||||||
|
|
||||||
app 'travis-ci/travis-core/jobs/1'
|
app 'travis-ci/travis-core/jobs/1'
|
||||||
waitFor jobRendered
|
waitFor jobRendered
|
||||||
runs ->
|
runs ->
|
||||||
|
@ -32,6 +38,8 @@ describe 'on the "job" state', ->
|
||||||
build: { href: '/travis-ci/travis-core/builds/1' }
|
build: { href: '/travis-ci/travis-core/builds/1' }
|
||||||
job: { href: '/travis-ci/travis-core/jobs/1', active: true }
|
job: { href: '/travis-ci/travis-core/jobs/1', active: true }
|
||||||
|
|
||||||
|
waits 10
|
||||||
|
runs ->
|
||||||
displaysLog [
|
displaysLog [
|
||||||
'log 1'
|
'log 1'
|
||||||
]
|
]
|
||||||
|
|
|
@ -41,9 +41,8 @@
|
||||||
expect(element.text()).toEqual data.message
|
expect(element.text()).toEqual data.message
|
||||||
|
|
||||||
@displaysLog = (lines) ->
|
@displaysLog = (lines) ->
|
||||||
ix = 0
|
log = lines.join()
|
||||||
log = $.map(lines, (line) -> ix += 1; "#{ix}#{line}").join("\n")
|
expect($('#log').text().trim()).toEqual log
|
||||||
expect($('#log p').text().trim()).toEqual log
|
|
||||||
|
|
||||||
@listsRepos = (items) ->
|
@listsRepos = (items) ->
|
||||||
listsItems('repo', items)
|
listsItems('repo', items)
|
||||||
|
|
|
@ -129,7 +129,7 @@ describe 'Travis.Model - incomplete', ->
|
||||||
|
|
||||||
waits 50
|
waits 50
|
||||||
runs ->
|
runs ->
|
||||||
expect( record.get('description') ).toEqual 'bar'
|
expect( other.get('record.description') ).toEqual 'bar'
|
||||||
expect( record.get('isComplete') ).toBeTruthy()
|
expect( record.get('isComplete') ).toBeTruthy()
|
||||||
|
|
||||||
it 'loads missing data on try to get it', ->
|
it 'loads missing data on try to get it', ->
|
||||||
|
|
Loading…
Reference in New Issue
Block a user