Skip to content

Set up webmock & add first tests using it

Nina requested to merge nina/spec into master

This MR introduces Webmock - a library for stubbing and setting expectations on HTTP requests.

I have used it, to set up a feature spec (superadmin edits subscription). This functionality has been tested in a controller spec, that I have removed. The Rails and the Rspec core team recommend to use request specs instead of controller specs for new apps. [1] The app isn't new, but since there is only one working controller spec atm, it makes sense to switch now.

The user signs in spec now uses also Webmock, which will hopefully remove the flakiness. Other than that a spec for the subscription model has been added.

I hope these specs give an example and make it easier to write tests for other cases :).

My next goal would be to introduce a fake-schleuder, in order to not have to set up all the request stubs in each and every test.

[1] http://rspec.info/blog/2016/07/rspec-3-5-has-been-released/ and https://everydayrails.com/2016/08/29/replace-rspec-controller-tests.html

Merge request reports