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'
|
||||
repoBinding: 'controllers.repo.repo'
|
||||
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)
|
||||
if result && result.clientId
|
||||
@addLoadedData(type, result.clientId, hash)
|
||||
#@_updateRelationships(type, hash)
|
||||
|
||||
result
|
||||
|
||||
|
@ -158,3 +159,18 @@ Travis.Store = DS.Store.extend
|
|||
root = type.pluralName()
|
||||
@adapter.sideload(store, 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,22 +19,24 @@
|
|||
<dd class="duration" {{bindAttr title="startedAt"}}>{{formatDuration job.duration}}</dd>
|
||||
</div>
|
||||
|
||||
<div class="right">
|
||||
<dt>{{t jobs.commit}}</dt>
|
||||
<dd class="commit"><a {{bindAttr href="urlGithubCommit"}}>{{formatCommit commit}}</a></dd>
|
||||
{{#if commit.compareUrl}}
|
||||
<dt>{{t jobs.compare}}</dt>
|
||||
<dd class="compare"><a {{bindAttr href="commit.compareUrl"}}>{{pathFrom commit.compareUrl}}</a></dd>
|
||||
{{/if}}
|
||||
{{#if commit.authorName}}
|
||||
<dt>{{t jobs.author}}</dt>
|
||||
<dd class="author"><a {{bindAttr href="urlAuthor"}}>{{commit.authorName}}</a></dd>
|
||||
{{/if}}
|
||||
{{#if commit.committerName}}
|
||||
<dt>{{t jobs.committer}}</dt>
|
||||
<dd class="committer"><a {{bindAttr href="urlCommitter"}}>{{commit.committerName}}</a></dd>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{#if commit}}
|
||||
<div class="right">
|
||||
<dt>{{t jobs.commit}}</dt>
|
||||
<dd class="commit"><a {{bindAttr href="urlGithubCommit"}}>{{formatCommit commit}}</a></dd>
|
||||
{{#if commit.compareUrl}}
|
||||
<dt>{{t jobs.compare}}</dt>
|
||||
<dd class="compare"><a {{bindAttr href="commit.compareUrl"}}>{{pathFrom commit.compareUrl}}</a></dd>
|
||||
{{/if}}
|
||||
{{#if commit.authorName}}
|
||||
<dt>{{t jobs.author}}</dt>
|
||||
<dd class="author"><a {{bindAttr href="urlAuthor"}}>{{commit.authorName}}</a></dd>
|
||||
{{/if}}
|
||||
{{#if commit.committerName}}
|
||||
<dt>{{t jobs.committer}}</dt>
|
||||
<dd class="committer"><a {{bindAttr href="urlCommitter"}}>{{commit.committerName}}</a></dd>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
<dt>{{t jobs.message}}</dt>
|
||||
<dd class="message">{{formatMessage commit.message}}</dd>
|
||||
|
|
|
@ -42,14 +42,14 @@
|
|||
# undefined key
|
||||
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'
|
||||
message += ", in state: #{@get('state')}"
|
||||
console.log message
|
||||
return if @get('isCompleting')
|
||||
@set 'isCompleting', true
|
||||
|
||||
if @get('stateManager.currentState.path') != 'rootState.loaded.materializing'
|
||||
unless @get('stateManager.currentState.path').match /^rootState.loaded.materializing/
|
||||
@reload()
|
||||
@set 'incomplete', false
|
||||
|
||||
|
|
|
@ -54,10 +54,9 @@ describe 'events', ->
|
|||
started_at: '2012-07-02T00:02:00Z'
|
||||
finished_at: '2012-07-02T00:02:55Z'
|
||||
event_type: 'push'
|
||||
result: 1
|
||||
message: 'commit message 3'
|
||||
commit: '1234567'
|
||||
state: 'started'
|
||||
state: 'failed'
|
||||
|
||||
Em.run ->
|
||||
Travis.receive 'build:started', payload
|
||||
|
@ -75,40 +74,6 @@ describe 'events', ->
|
|||
runs ->
|
||||
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', ->
|
||||
payload =
|
||||
job:
|
||||
|
@ -191,7 +156,7 @@ describe 'events', ->
|
|||
app '/travis-ci/travis-core'
|
||||
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 =
|
||||
worker:
|
||||
id: 1
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
describe 'on the "job" state', ->
|
||||
beforeEach ->
|
||||
$.mockjax
|
||||
url: '/jobs/1/log?cors_hax=true'
|
||||
responseTime: 0
|
||||
responseText: 'log 1'
|
||||
|
||||
|
||||
app 'travis-ci/travis-core/jobs/1'
|
||||
waitFor jobRendered
|
||||
runs ->
|
||||
|
@ -32,6 +38,8 @@ describe 'on the "job" state', ->
|
|||
build: { href: '/travis-ci/travis-core/builds/1' }
|
||||
job: { href: '/travis-ci/travis-core/jobs/1', active: true }
|
||||
|
||||
displaysLog [
|
||||
'log 1'
|
||||
]
|
||||
waits 10
|
||||
runs ->
|
||||
displaysLog [
|
||||
'log 1'
|
||||
]
|
||||
|
|
|
@ -41,9 +41,8 @@
|
|||
expect(element.text()).toEqual data.message
|
||||
|
||||
@displaysLog = (lines) ->
|
||||
ix = 0
|
||||
log = $.map(lines, (line) -> ix += 1; "#{ix}#{line}").join("\n")
|
||||
expect($('#log p').text().trim()).toEqual log
|
||||
log = lines.join()
|
||||
expect($('#log').text().trim()).toEqual log
|
||||
|
||||
@listsRepos = (items) ->
|
||||
listsItems('repo', items)
|
||||
|
|
|
@ -129,7 +129,7 @@ describe 'Travis.Model - incomplete', ->
|
|||
|
||||
waits 50
|
||||
runs ->
|
||||
expect( record.get('description') ).toEqual 'bar'
|
||||
expect( other.get('record.description') ).toEqual 'bar'
|
||||
expect( record.get('isComplete') ).toBeTruthy()
|
||||
|
||||
it 'loads missing data on try to get it', ->
|
||||
|
|
Loading…
Reference in New Issue
Block a user