Pages: 404 Published: February 2018 ISBN: 9781680502503
In Print
Rails 5 Test Prescriptions
Build a Healthy Codebase
by Noel Rappin
Does your Rails code suffer from bloat, brittleness, or inaccuracy? Cure
these problems with the regular application of test-driven development.
You’ll use Rails 5.2, Minitest 5, and RSpec 3.7, as well as popular
testing libraries such as factory_bot and Cucumber. Updates include
Rails 5.2 system tests and Webpack integration. Do what the doctor
ordered to make your applications feel all better. Side effects may
include better code, fewer bugs, and happier developers.
Your Ruby on Rails application is sick. Deadlines are looming, but every
time you make the slightest change to the code, something else breaks.
Nobody remembers what that tricky piece of code was supposed to do, and
nobody can tell what it actually does. Plus, it has bugs. You need
test-driven development: a process for improving the design,
maintainability, and long-term viability of software.
With both practical code examples and discussion of why testing works,
this book starts with the most basic features delivered as part of core
Ruby on Rails. Once you’ve integrated those features into your coding
practice, work with popular third-party testing tools such as RSpec,
Jasmine, Cucumber, and factory_bot. Test the component parts of a Rails
application, including the back-end model logic and the front-end
display logic. With Rails examples, use testing to enable your code to
respond better to future change. Plus, see how to handle real-world
testing situations.
This new edition has been updated to Rails 5.2 and RSpec 3.7 and
contains full coverage of new Rails features, including system tests and
the Webpack-based JavaScript setup.
Production is complete. Now it’s on to layout and the printer.
2017/11/30
B2.0
*This release adds the final chapters, Chapter 13, Testing for Security, which looks at applying testing techniques to security; Chapter 14, Testing External Services, which goes beyond the application and looks at external services; Chapter 15, Troubleshooting and Debugging, which looks at tools for diagnosing failing tests; Chapter 16, Running Tests Faster and Running Faster Tests, which looks at ways to speed up your tests; and Chapter 17, Testing Legacy Code, which talks about strategies for dealing with the particular issues of legacy code.
*Reported errata have been fixed.
*The book is now content-complete and headed to production.
Noel Rappin is a Principal Software Engineer at Table XI, and is the
author of multiple technical books. Before joining Table XI, Noel ran
internal training at Groupon, and has a Ph.D. in educational technology
and user-centered design from the GVU Lab at the Georgia Institute of
Technology. Find Noel online at
noelrappin.com.