diff --git a/app/controllers/caches.coffee b/app/controllers/caches.coffee index 246101d4..2bcb644f 100644 --- a/app/controllers/caches.coffee +++ b/app/controllers/caches.coffee @@ -14,7 +14,7 @@ Controller = Ember.Controller.extend deletingDone = => @set('isDeleting', false) repo = @get('repo') - Ajax.ajax("/repos/#{repo.get('id')}/caches", "DELETE").then(deletingDone, deletingDone).then => + Ajax.ajax("/repos/#{@get('cache.repository_id')}/caches", "DELETE").then(deletingDone, deletingDone).then => @set('model', {}) `export default Controller` diff --git a/app/routes/caches.coffee b/app/routes/caches.coffee index 3b6132fe..b1ee7944 100644 --- a/app/routes/caches.coffee +++ b/app/routes/caches.coffee @@ -7,7 +7,6 @@ Route = TravisRoute.extend setupController: (controller) -> @_super.apply this, arguments @controllerFor('repo').activate('caches') - controller.set('repo', @controllerFor('repo').get('repo')) model: -> repo = @modelFor('repo') diff --git a/tests/unit/components/caches-item-test.coffee b/tests/unit/components/caches-item-test.coffee index 3eef9311..dae8b87b 100644 --- a/tests/unit/components/caches-item-test.coffee +++ b/tests/unit/components/caches-item-test.coffee @@ -1,17 +1,23 @@ `import { test, moduleForComponent } from 'ember-qunit'` moduleForComponent 'caches-item', 'CachesItemComponent', { - # specify the other units that are required for this test - # needs: ['component:foo', 'helper:bar'] + needs: ['helper:format-time', 'helper:mb'] } test 'it renders', -> - expect 2 - # creates the component instance - component = @subject() - equal component._state, 'preRender' + attributes = { + repository_id: 10, + size: 1024 * 1024, + branch: "master", + last_modified: "2015-04-16T11:25:00Z", + type: "push" + } - # appends the component to the page + component = @subject(cache: attributes) @append() - equal component._state, 'inDOM' + + ok component.$().hasClass('push'), 'component should have a type class (push)' + equal component.$('.caches-branch').text().trim(), 'master', 'branch name should be displayed' + # equal component.$('.caches-date').text().trim(), '', '' + equal component.$('.caches-size').text().trim(), '1.00MB', 'size should be displayed'