vendredi 26 décembre 2014

What is the scope of the mocks created by mocha when used in rspec?

In my rspec test suite I use mocha library to create mocks/stubs and test doubles. Examples in my rspec suite run in random order, as recommended. For some reason a few examples now fail randomly. I already ruled out shared database state and global variables (I confess: there are global variables in my Rails app).


Another logical suspect (maybe) is the mocking library. According to rspec documentation here rspec would clean out all mocks after each example, even those created in before(:all). This should work with any mocking library, right? Maybe...


For historic reasons my test suite doesn't use built-in rspec mocks, we use mocha library.


Question: would rspec clean out all mocks/stubs created by mocha after each example?


Aucun commentaire:

Enregistrer un commentaire