Skip to content

Instantly share code, notes, and snippets.

@8vius
Created September 2, 2015 17:41
Show Gist options
  • Save 8vius/0c2a5d6f8b6d9814526d to your computer and use it in GitHub Desktop.
Save 8vius/0c2a5d6f8b6d9814526d to your computer and use it in GitHub Desktop.
1 #= require invoices.module
2 #= require invoices/perception_fields.directive
3
4 describe "perceptionFields", ->
5 [scope, perceptionsCtrl] = []
6
7 beforeEach ->
8 module "app.invoices"
9
10 inject ($compile, $rootScope) ->
11 perceptionsCtrl = jasmine.createSpyObj "perceptionsCtrl", [
12 "registerPerception"
13 "removePerception"
14 "updateTotals"
15 ]
16 element = angular.element("<perception-fields></perception-fields>")
17 element.data("$perceptionsController", perceptionsCtrl)
18 element = $compile(element)($rootScope)
19 scope = element.scope()
20
21 describe "#removePerception", ->
22 it "removes perception", ->
23 scope.removePerception()
24
25 expect(perceptionsCtrl.removePerception).toHaveBeenCalledWith(scope.perception)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment