Rails 4 Test Prescriptions
Build a Healthy Codebase
Publisher: Pragmatic Bookshelf
Final Release Date: December 2014
Pages: 350

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 Need:Ruby 2.1, Rails 4

Product Details
About the Author
Recommended for You
Customer Reviews


by PowerReviews
oreillyRails 4 Test Prescriptions

(based on 1 review)

Ratings Distribution

  • 5 Stars



  • 4 Stars



  • 3 Stars



  • 2 Stars



  • 1 Stars



Reviewed by 1 customer

Displaying review 1

Back to top

(1 of 3 customers found this review helpful)


Ruby testing ecosystem in a nutshell

By johno

from Bratislava

About Me Developer

Verified Reviewer


  • Easy to understand
  • Well-written


    Best Uses

    • Intermediate

    Comments about oreilly Rails 4 Test Prescriptions:

    TL;DR Great overview of Ruby on Rails testing ecosystem, not so great if you actually want to learn testing.

    Rails 4 Test Prescriptions is a well written book about the current state of Ruby/Rails testing. If you are new to Rails/Ruby testing world, this book is invaluable. You will find everything you need to test you code from every angle. Testing models, controllers, helpers, views, frameworks... it's all there. However if you are looking for a great intro into TDD/BDD I would recommend you look up classics by Kent Beck: Test Driven Development by Example or if you want to get more advanced grab a copy of Growing Object Oriented Software Guided by Tests by Nat Pryce and Steve Freeman. These are Java books, but game-changing reads.

    Disclaimer: I've received this book through O'Reilly User Group program.

    Displaying review 1

    Back to top

    Buy 2 Get 1 Free Free Shipping Guarantee
    Buying Options
    Immediate Access - Go Digital what's this?
    Print:  $38.00