Getting an order cycle update function in place like a boss

This commit is contained in:
Will Marshall
2013-12-11 12:42:02 +11:00
parent 63dfa0b696
commit 4db8f755bf
5 changed files with 76 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
describe 'Shop controllers', ->
describe 'ProductsCtrl', ->
ctrl = null
scope = null
event = null
Product = null
beforeEach ->
module('Shop')
scope = {}
Product =
all: ->
'testy mctest'
inject ($controller) ->
ctrl = $controller 'ProductsCtrl', {$scope: scope, Product : Product}
it 'Fetches products from Product', ->
expect(scope.products).toEqual 'testy mctest'
describe 'OrderCycleCtrl', ->
ctrl = null
scope = null
event = null
OrderCycle = null
beforeEach ->
module 'Shop'
scope = {}
inject ($controller) ->
ctrl = $controller 'OrderCycleCtrl'

View File

@@ -0,0 +1,15 @@
describe 'Product service', ->
$httpBackend = null
Product = null
beforeEach ->
module 'Shop'
inject ($injector, _$httpBackend_)->
Product = $injector.get("Product")
$httpBackend = _$httpBackend_
it "Fetches products from the backend", ->
$httpBackend.expectGET("/shop/products").respond([{test : "cats"}])
products = Product.all()
$httpBackend.flush()
expect(products[0].test).toEqual "cats"