You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using so_stub_very_test cut a huge chunk out of the time it took us to write API stubs in the old Heroku Dashboard. I'd love to see something like it just built into Excon. Once we replaced all of the Excon stubs with so_stub_very_test stubs, we also had a much easier time identifying and preventing test cross-pollution (since Excon stubs stick around forever, it was easy to forget to clear stubs specific to individual specs/groups).
Summary of what's most useful:
Stubs via strings with naïve placeholders (e.g. stub_get "/apps/:app_identifier")
Default stubs that aren't cleared by default (e.g. SoStubVeryTest.defaults do #etc)
Easy clearing of non-default stubs (e.g. SoStubVeryTest.clear_custom_stubs)
It's especially useful in cases where I'm testing something that makes lots of API calls, but only care about stubbing one of those endpoints. I'd just like the other endpoints to respond by default with an empty array or some default hash I've defined.
Thanks for the overview. I've known for a while that we should probably try to further improve this stuff but hadn't made much progress more recently. One idea was to have namespaced stubs, so that you could add/remove/clear based on a name, which might support the default/non-default (though the idea was never wholly fleshed out). I'll definitely keep these things in mind though, we got kind of an MVP going here and just haven't taken the time to flesh it out. Better understanding the pain points from actual usage should definitely help with that though. Thanks!
/cc @jclem
Not sure what all we could borrow, but allowing strings instead of regexes seems like it could be super handy.
The text was updated successfully, but these errors were encountered: