Created
September 15, 2014 20:18
-
-
Save balinterdi/00ad17faf5c9e9704f3c to your computer and use it in GitHub Desktop.
controller_test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var stuntAnalytics; | |
moduleFor('controller:song', 'Unit - Song controller', { | |
needs: [ | |
'controller:song' | |
], | |
setup: function() { | |
stuntAnalytics = MockAnalytics.create(); // create with a mock library, like sinon; | |
this.container.register('service:analytics', stuntAnalytics); | |
this.container.inject('controller', 'analytics', 'service:analytics'); | |
} | |
}); | |
test('Analytics', function() { | |
var controller = this.container.create('controller:post'); | |
controller.sendAnalytics({ type: "click", value: '2', currency: 'USD' }); | |
test(..., "The analytics service is called with the correct parameters"); // verify the mock | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment