Dumping OrderCycle data via :javascript tags instead of ng-init, Angularising the selector stuff

This commit is contained in:
Will Marshall
2013-12-18 17:05:47 +11:00
parent 1f012dc52c
commit b3a4d826b8
4 changed files with 18 additions and 9 deletions

View File

@@ -6,10 +6,12 @@ describe 'OrderCycle service', ->
}
beforeEach ->
angular.module('Shop').value('orderCycleData', {})
module 'Shop', ($provide)->
$provide.value "Product", mockProduct
null # IMPORTANT
# You must return null because module() is a bit dumb
inject (_OrderCycle_, _$httpBackend_)->
$httpBackend = _$httpBackend_
OrderCycle = _OrderCycle_
@@ -23,4 +25,11 @@ describe 'OrderCycle service', ->
$httpBackend.flush()
expect(mockProduct.update).toHaveBeenCalled()
it "updates the orders_close_at attr after update", ->
datestring = "2013-12-20T00:00:00+11:00"
$httpBackend.expectPOST("/shop/order_cycle").respond({orders_close_at: datestring})
OrderCycle.push_order_cycle()
$httpBackend.flush()
expect(OrderCycle.order_cycle.orders_close_at).toEqual(datestring)