In some of my directives, I\'m adding functions to the scope to handle logic specific for the directive. For example:
link: function(scope, element, attrs) {
If needed, it's possible to directly unit test the link method of a directive. See the unit tester of the angular-ice module: "testing a directive configuration"
http://bverbist.github.io/angular-ice/#/unitTester
example usage: https://github.com/bverbist/angular-ice/blob/master/app/components/icebank/bank-account-number-directive_link_test.js
In your case you can keep a reference to the scope object you pass to the directive's link method, and then you can directly test the doStuff function on that scope.