Skip to content

Instantly share code, notes, and snippets.

@willrjmarshall
Created December 10, 2013 23:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save willrjmarshall/7902546 to your computer and use it in GitHub Desktop.
Save willrjmarshall/7902546 to your computer and use it in GitHub Desktop.
describe 'OrderCycle service', ->
$httpBackend = null
OrderCycle = null
Product = {
all: -> {}
}
beforeEach ($provide)->
module 'Shop'
$provide.value('Product', Product);
inject ($injector, _$httpBackend_, Product)->
OrderCycle = $injector.get("OrderCycle")
$httpBackend = _$httpBackend_
it "posts the order_cycle ID and tells product to update", ->
$httpBackend.expectPOST("/shop/order_cycle", {"order_cycle_id" : 10}).respond(200)
$httpBackend.expectGET("/shop/products").respond(200)
OrderCycle.set_order_cycle(10)
$httpBackend.flush()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment