Mailinglist Archive: opensuse-buildservice (176 mails)

< Previous Next >
[opensuse-buildservice] Should we move from controller to request specs?
Hi all, I've been reading this blog post about changes to controller tests in rails 5 and it seems that controller specs
are becoming "outdated" in favour of request specs.

https://everydayrails.com/2016/08/29/replace-rspec-controller-tests.html

"Both the Rails and RSpec teams suggest replacing or removing your app’s controller tests (also known as the functional test layer), in favor of directly testing models (units), or with higher-level integration tests"

Also some helper methods like `assigns` and `assert_template` have been move to an external gem and are no longer part of core rails, this makes me wonder how much longer rails will be supporting controller specs like we have now?

Further more it seems like our controller specs are becoming more and more like request specs anyway, for example this controller spec renders the views and asserts on the response. We may as well make this a request spec so we get full coverage of the http stack and also coverage of the routes too:

https://github.com/Ana06/open-build-service/blob/3e24492828f02d6f5e3631e3d631df1dca4ca286/src/api/spec/controllers/source_controller_spec.rb#L42

One more question I have, we currently have two test suites, one in /spec and on in /test, are we going to maintain both of these forever or should we try to move over to one and eventually get rid of the other one?

- Evan


--
Evan Rolfe
Full Stack Web Developer
SUSE Linux GmbH, Maxfeldstr. 5, D-90409 Nürnberg
Tel: +49-911-74053-0; Fax: +49-911-7417755; https://www.suse.com/
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard,
Graham Norton, HRB 21284 (AG Nürnberg)

--
To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse-buildservice+owner@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages