What You’ve Done

In this chapter you learned about strategies for dealing with Rails models and looked at a way of driving the TDD process to add a particular feature. Once the process is added, the next step is refactoring, and you looked at how to mitigate complexity, duplication, and missing abstractions. You also looked at testing Rails features such as associations and validations, and at how to create your own RSpec matchers if the built-in ones aren’t expressive enough.

The guidelines discussed in this chapter should give you some direction as you test-drive new business logic in your Rails application. Every test you write, however, depends on some data to run. Getting useful data into the test cleanly and quickly turns out to be kind ...

Get Rails 5 Test Prescriptions now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.