What are the different kinds of Rails tests and when should I use each? - Code with Jason

07-Nov-2020 1126
The eight types of RSpec specsThe RSpec library offers a lot of different spec types.Model specsSystem specs/feature specs*Request specs/controller specs*Helper specsView specsRouting specsMailer specsJob specsThere are two lines with asterisks. These are cases where the RSpec team decreed one spec type obsolete and replaced it with a new type. I’m only including those ones for completeness.So the up-to-date list is really the following.Model specsSystem specsRequest specsHelper specsView specsRouting specsMailer specsJob specsHere’s when I use each.Model specs – alwaysSystem specs – alwaysRequest specs – rarelyHelper specs – rarelyView specs – neverRouting specs – neverMailer specs – neverJob specs – neverLet’s talk about each of these spec types in detail. I’ll explain why I use the ones I use and why I ignore the ones I ignore.
Use coupon code:

RUBYONRAILS

to get 30% discount on our bundle!
Prepare for your next tech interview with our comprehensive collection of programming interview guides. Covering JavaScript, Ruby on Rails, React, and Python, these highly-rated books offer thousands of essential questions and answers to boost your interview success. Buy our 'Ultimate Job Interview Preparation eBook Bundle' featuring 2200+ questions across multiple languages. Ultimate Job Interview Preparation eBook Bundle