Jump to ratings and reviews
Rate this book

Rails 4 Test Prescriptions: Build a Healthy Codebase

Rate this book
Does your Rails code suffer from bloat, brittleness, or inaccuracy? Cure these problems with a regular dose of test-driven development. Rails 4 Test Prescriptions is a comprehensive guide to how tests can help you design and write better Rails applications. In this completely revised edition, you'll learn why testing works and how to test effectively using Rails 4, Minitest 5, and RSpec 3, as well as popular testing libraries such as factory_girl and Cucumber. 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.

Containing 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, you'll learn how to use popular third-party testing tools such as RSpec, Mocha, Cucumber, and factory_girl. You'll test the component parts of a Rails application, including the back-end model logic and the front-end display logic. Using Rails examples, you'll learn how to use testing to enable your code to respond better to future change. Plus, you'll see how to handle real-world testing situations.

This completely revised edition contains a new tutorial, as well as new examples throughout the book. Many chapters, including the JavaScript chapter, have undergone major changes to reflect new tools and new practices. And there are brand new chapters on testing for security, and testing external services.

What You
Ruby 2.1, Rails 4

350 pages, Paperback

First published October 25, 2014

10 people are currently reading
63 people want to read

About the author

Noel Rappin

18 books4 followers

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
25 (44%)
4 stars
25 (44%)
3 stars
6 (10%)
2 stars
0 (0%)
1 star
0 (0%)
Displaying 1 - 4 of 4 reviews
Profile Image for Anton Antonov.
351 reviews48 followers
November 25, 2015
The better Rails 4 (RSpec) testing book.

Focusing on how to test, why to test and writing fast tests.

Covers the most useful scenarios and overlaps with https://github.com/eliotsykes/rspec-r... which can only be a good thing.

If you don't know much about BDD/TDD and how to write tests not to mention good tests, this is a good book to learn from.
Profile Image for Orban.
41 reviews
January 27, 2015
I made a lot of notes while I was reading the book. I was already using some of the described methodics, but there were some new things which are clearer now. And can't wait to apply those in practice.
Profile Image for Jason.
5 reviews
May 7, 2015
If this book was any more exciting, it would no longer be a book about software testing.

One cool feature of the book is that the examples you're implementing as you go through the book all belong to the same project, so you've got a good context to work from throughout the book.
Displaying 1 - 4 of 4 reviews

Can't find what you're looking for?

Get help and learn more about the design.