Rails 4 Test Prescriptions: Build a Healthy Codebase (Paperback)

Noel Rappin

  • 出版商: Pragmatic Bookshelf
  • 出版日期: 2014-12-13
  • 定價: $1,250
  • 售價: 5.0$625
  • 語言: 英文
  • 頁數: 350
  • 裝訂: Paperback
  • ISBN: 1941222196
  • ISBN-13: 9781941222195
  • 相關分類: Ruby
  • 立即出貨(限量) (庫存=2)

買這商品的人也買了...

商品描述

Does your Rails code suffer from bloat, brittleness, or inaccuracy? Cure these problems with the regular application 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

商品描述(中文翻譯)

你的 Rails 代碼是否存在冗餘、脆弱或不準確的問題?通過定期應用測試驅動開發,可以解決這些問題。《Rails 4 測試處方》是一本全面指南,介紹了測試如何幫助你設計和撰寫更好的 Rails 應用程序。在這本完全修訂的新版中,你將學習到測試的原理以及如何使用 Rails 4、Minitest 5 和 RSpec 3 進行有效的測試,還有一些流行的測試庫,如 factory_girl 和 Cucumber。按照醫生的建議,讓你的應用程序感覺更好。副作用可能包括更好的代碼、更少的錯誤和更快樂的開發人員。

你的 Ruby on Rails 應用程序有問題。截止日期逼近,但每次稍微修改代碼,其他地方就會出現問題。沒有人記得那個棘手的代碼應該做什麼,也沒有人知道它實際上做了什麼。而且還有錯誤。你需要測試驅動開發,這是一個改善軟件設計、可維護性和長期可行性的過程。

本書包含實用的代碼示例和關於測試原理的討論,從核心 Ruby on Rails 的基本功能開始介紹。一旦你將這些功能融入到你的編碼實踐中,你將學習如何使用流行的第三方測試工具,如 RSpec、Mocha、Cucumber 和 factory_girl。你將測試 Rails 應用程序的組件部分,包括後端模型邏輯和前端顯示邏輯。通過 Rails 的示例,你將學習如何使用測試使你的代碼更好地應對未來的變化。此外,你還將看到如何處理現實世界的測試情況。

這本完全修訂的新版包含了一個新的教程,以及全書中的新例子。許多章節,包括 JavaScript 章節,都經歷了重大變化,以反映新的工具和新的實踐方法。還新增了關於安全測試和測試外部服務的全新章節。

所需材料:Ruby 2.1、Rails 4