Hi.
I am using Cucumber as the BDD framework with rspec/mocha mocking. Ideally we would not mock/stub behavior in cucumber specs; however the scenario is exceptional here. To give you the brief idea of problem here; I have two features product feature and cart feature.
Cart feature is currently mocking some of the product fetch from 3 party system. And in cucumber run cart feature runs before product feature. Product feature uses real call for some scenarios. Ideally we would expect that Class level stubs like Product.stub(:find) would be cleared once the scenarios are completed; however that is not the case. Class level stubs linger on to the next cucumber scenario run and interfere with the call.
I interchangeably used mocha and rspec to induce the stubs; but no avail; in either case the stub remains and prevents my product feature to run after cart feature. Both of them run fine in isolation.
Has anyone faced similar issue of stubs not being reset in cucumber? Is there a way, I can restore the original class behavior?
Any help will be appreciated.
Cheers