Rails 4 Test Prescriptions: Build a Healthy Codebase Front Cover

Rails 4 Test Prescriptions: Build a Healthy Codebase

  • Length: 350 pages
  • Edition: 1
  • Publisher:
  • Publication Date: 2014-12-13
  • ISBN-10: 1941222196
  • ISBN-13: 9781941222195
  • Sales Rank: #1327058 (See Top 100 Books)
Description

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

Table of Contents

Chapter 1. Introduction
Chapter 2. Test-Driven Development Basics
Chapter 3. Test-Driven Rails
Chapter 4. What Makes Great Tests
Chapter 5. Testing Models
Chapter 6. Adding Data to Tests
Chapter 7. Using Test Doubles as Mocks and Stubs
Chapter 8. Testing Controllers and Views
Chapter 9. Minitest
Chapter 10. Integration Testing
Chapter 11. Testing for Security
Chapter 12. Testing External Services
Chapter 13. Testing JavaScript
Chapter 14. Troubleshooting and Debugging
Chapter 15. Running Tests Faster
Chapter 16. Testing Legacy Code

To access the link, solve the captcha.