Rename sshKey to ssh_key for ember-data lookups
This commit is contained in:
parent
507dcc7376
commit
8aac1c062d
|
@ -10,7 +10,7 @@ AddSshKeyComponent = Ember.Component.extend
|
||||||
|
|
||||||
didInsertElement: () ->
|
didInsertElement: () ->
|
||||||
id = @get('repo.id')
|
id = @get('repo.id')
|
||||||
model = @get('store').recordForId('sshKey', id)
|
model = @get('store').recordForId('ssh_key', id)
|
||||||
# TODO: this can be removed in favor of simply unloading record
|
# TODO: this can be removed in favor of simply unloading record
|
||||||
# once https://github.com/emberjs/data/pull/2867
|
# once https://github.com/emberjs/data/pull/2867
|
||||||
# and https://github.com/emberjs/data/pull/2870 are merged
|
# and https://github.com/emberjs/data/pull/2870 are merged
|
||||||
|
@ -20,7 +20,7 @@ AddSshKeyComponent = Ember.Component.extend
|
||||||
idToRecord = typeMap.idToRecord
|
idToRecord = typeMap.idToRecord
|
||||||
delete idToRecord[id]
|
delete idToRecord[id]
|
||||||
|
|
||||||
model = @get('store').createRecord('sshKey', id: id)
|
model = @get('store').createRecord('ssh_key', id: id)
|
||||||
@set('model', model)
|
@set('model', model)
|
||||||
|
|
||||||
isValid: () ->
|
isValid: () ->
|
||||||
|
|
|
@ -18,7 +18,7 @@ Route = TravisRoute.extend
|
||||||
fetchCustomSshKey: () ->
|
fetchCustomSshKey: () ->
|
||||||
repo = @modelFor('repo')
|
repo = @modelFor('repo')
|
||||||
self = this
|
self = this
|
||||||
@store.find('sshKey', repo.get('id')).then ( (result) -> result unless result.get('isNew') ), (xhr) ->
|
@store.find('ssh_key', repo.get('id')).then ( (result) -> result unless result.get('isNew') ), (xhr) ->
|
||||||
if xhr.status == 404
|
if xhr.status == 404
|
||||||
# if there is no model, just return null. I'm not sure if this is the
|
# if there is no model, just return null. I'm not sure if this is the
|
||||||
# best answer, maybe we should just redirect to different route, like
|
# best answer, maybe we should just redirect to different route, like
|
||||||
|
|
|
@ -8,7 +8,7 @@ Route = TravisRoute.extend
|
||||||
model: (params) ->
|
model: (params) ->
|
||||||
repo = @modelFor('repo')
|
repo = @modelFor('repo')
|
||||||
self = this
|
self = this
|
||||||
@store.find('sshKey', repo.get('id')).then ( (result) -> result unless result.get('isNew') ), (xhr) ->
|
@store.find('ssh_key', repo.get('id')).then ( (result) -> result unless result.get('isNew') ), (xhr) ->
|
||||||
if xhr.status == 404
|
if xhr.status == 404
|
||||||
# if there is no model, just return null. I'm not sure if this is the
|
# if there is no model, just return null. I'm not sure if this is the
|
||||||
# best answer, maybe we should just redirect to different route, like
|
# best answer, maybe we should just redirect to different route, like
|
||||||
|
|
|
@ -22,7 +22,7 @@ test('it adds an ssh key on submit', function(assert) {
|
||||||
|
|
||||||
this.render(hbs`{{add-ssh-key repo=repo sshKeyAdded="sshKeyAdded"}}`);
|
this.render(hbs`{{add-ssh-key repo=repo sshKeyAdded="sshKeyAdded"}}`);
|
||||||
|
|
||||||
var sshKey = store.all('sshKey').objectAt(0);
|
var sshKey = store.all('ssh_key').objectAt(0);
|
||||||
|
|
||||||
assert.ok(! sshKey.get('description'), 'description should be blank');
|
assert.ok(! sshKey.get('description'), 'description should be blank');
|
||||||
assert.ok(! sshKey.get('value'), 'value should be blank');
|
assert.ok(! sshKey.get('value'), 'value should be blank');
|
||||||
|
@ -54,7 +54,7 @@ test('it throws an error if value for ssh key is blank', function(assert) {
|
||||||
|
|
||||||
this.render(hbs`{{add-ssh-key repo=repo sshKeyAdded="sshKeyAdded"}}`);
|
this.render(hbs`{{add-ssh-key repo=repo sshKeyAdded="sshKeyAdded"}}`);
|
||||||
|
|
||||||
var sshKey = store.all('sshKey').objectAt(0);
|
var sshKey = store.all('ssh_key').objectAt(0);
|
||||||
|
|
||||||
assert.ok(! sshKey.get('description'), 'description should be blank');
|
assert.ok(! sshKey.get('description'), 'description should be blank');
|
||||||
assert.ok(! sshKey.get('value'), 'value should be blank');
|
assert.ok(! sshKey.get('value'), 'value should be blank');
|
||||||
|
|
Loading…
Reference in New Issue
Block a user