Hello! Welcome back to the Ruby community!
There seems to be a bit of confusion in your post, which hopefully I can clarify. The parts of Rails testing stack we used for controller specs was deprecated by the Rails team due to being “only part of the story” of a request, they were an incomplete part of the controller request life cycle and so were never really unit tests, you can still use them with the addition of the `rails-controller-tests` gem but the suggested replacement is request specs. A request spec runs the entire rack stack so can be entirely Ruby based, but offers a realistic insight into the full request life cycle as an integration test. This sounds like what you want for testing your API. System tests (and thus specs) are an end to end testing solution, allowing testing of browsers and Javascript against your web server of choice, but equally, you could choose to use to have a complete acceptance style test. Where you send full on JSON to the web server and have it passed to Rails. Wether the extra boot time is enough to discourage you from this for the extra gain is up to you. Additionally, although capybara is used to talk HTML to rails in tests, you still have access to the raw `rack-test` helpers to send JSON or params etc. So the two things are different, and can still be used together, or not, as you decide. Hope that helps! Cheers Jon Rowe --------------------------- [email protected] jonrowe.co.uk On 28 June 2020 at 21:38, Gregory Leepart wrote: > Hello. Long time reader, first time postr. > > I've been out of the RoR game for 3 years and am back in full on. I'm > upgraded my stack to the latest and greatest. > Rails 6.0.1.3 > Ruby 2.7.1p83 > devise (4.7.2) > > rspec-rails (4.0.1) > > factory_bot_rails (6.0.0) > > > I've been using the following tutorial to get me back up to speed. > http://apionrails.icalialabs.com/book/chapter_five It's an amazing tutorial, > but unfortunately it is very outdated, but I've been able to trouble shoot > most of the issues. > > > I've been working on the Controller spec tests, but from reading the benefits > of rspec-rails, rails, etc, I thought it prudent to bite the bullet and start > using Request Specs. (based on this > (http://rspec.info/blog/2016/07/rspec-3-5-has-been-released/) link) > > From there I found out I should be using Feature Specs, and now finally > system specs. > > So I'm supposed to write system specs, but that requires Capybara, and > further reading states: > > > I don't need a browser, or the over head. What I'm hoping is someone can tell > me what's the proper Spec to use to test the API only project and if I could > see an example of proper type of spec that would test the Users_Controller > (but NOT with 'type: :controller' as it should be 'type: :request' at a > minimum, 'type: :feature' most likely and maybe even 'type: :system' if > there's a valid reason to use Cabybara on a API only app. > > Thanks in advance for you time and effort. My apologies on my post, I'll have > to learn how to use the formatting better to make it more readable. > G > > > > > > -- You received this message because you are subscribed to the Google Groups "rspec" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/dejalu-217-4c8eefda-ed9b-45da-a052-514c240d7278%40jonrowe.co.uk.
