Unit test that an action was called in an observer


I’m pretty new to unit testing so bear with me…

I have a simple observer that fires an action based on a boolean. How can I unit test that this.send was called? I want to test the actual action logic in a separate test.



@Bryan_Neill I think one good option would be to use sinon (for an example off the top of my head of its use in a production ember addon see the ember-simple-auth tests). It includes a feature called “spies” which can tell you if a function was called and how many times. There’s an ember-sinon addon too for easy integration.


worked great, thank you!