Setting Up Rails System Tests
Rails system tests[42]—added in Rails 5.1[43]—allow you to perform high-level, end-to-end tests of your application. Rather than testing that individual functions or methods perform as they should (unit testing), they test the application based on how the user interacts with it—that is, via a web interface. They allow us to assert that when a user interacts with our application in a certain way (such as filling in forms, clicking links or buttons), the app responds as we’d expect (such as displaying the correct page, having the correct things appear on the page).
Although this kind of end-to-end test was possible previously—for example, with RSpec Feature specs[44]—system tests bring a number of benefits. We no ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access