Merge remote-tracking branch 'origin/master' into pr/1033

This commit is contained in:
Rob Harrington
2016-06-16 15:12:30 +10:00
34 changed files with 204 additions and 72 deletions

View File

@@ -29,7 +29,7 @@ describe "CustomersCtrl", ->
expect(CurrentShop.shop).toEqual {}
describe "setting the shop on scope", ->
customer = { id: 5, email: 'someone@email.com'}
customer = { id: 5, email: 'someone@email.com', code: 'a'}
customers = [customer]
beforeEach inject (pendingChanges) ->
@@ -52,6 +52,12 @@ describe "CustomersCtrl", ->
it "retrievs the list of customers", ->
expect(scope.customers).toDeepEqual customers
it "finds customers by code", ->
as = scope.findByCode('a')
expect(as).toDeepEqual customers
as = scope.findByCode('b')
expect(as).toDeepEqual []
describe "scope.add", ->
it "creates a new customer", ->
email = "customer@example.org"

View File

@@ -8,7 +8,8 @@ describe "AdminSimpleCreateOrderCycleCtrl", ->
outgoing_exchange = {}
beforeEach ->
scope = {}
scope =
$watch: jasmine.createSpy('$watch')
order_cycle =
coordinator_id: 123
incoming_exchanges: [incoming_exchange]

View File

@@ -15,6 +15,7 @@ describe "TagRulesCtrl", ->
inject ($rootScope, $controller) ->
scope = $rootScope
scope.enterprise_form = jasmine.createSpyObj('enterprise_form', ['$setDirty'])
ctrl = $controller 'TagRulesCtrl', {$scope: scope, enterprise: enterprise}
describe "tagGroup start indices", ->
@@ -27,6 +28,8 @@ describe "TagRulesCtrl", ->
scope.addNewRuleTo(scope.tagGroups[0], "DiscountOrder")
it "adds a new rule of the specified type to the rules array for the tagGroup", ->
expect(scope.enterprise_form.$setDirty).toHaveBeenCalled()
expect(scope.tagGroups[0].rules.length).toEqual 3
expect(scope.tagGroups[0].rules[2].type).toEqual "TagRule::DiscountOrder"