Rails 5 Test Prescriptions: Build a Healthy Codebase

Noel Rappin

  • 出版商: Pragmatic Bookshelf
  • 出版日期: 2018-03-27
  • 售價: $1,840
  • 貴賓價: 9.5$1,748
  • 語言: 英文
  • 頁數: 406
  • 裝訂: Paperback
  • ISBN: 1680502506
  • ISBN-13: 9781680502503
  • 相關分類: Ruby
  • 立即出貨 (庫存 < 3)



Does your Rails code suffer from bloat, brittleness, or inaccuracy? Cure these problems with the regular application of test-driven development. You'll use Rails 5.1, Minitest 5, and RSpec 3.6, as well as popular testing libraries such as factory_girl and Cucumber. Updates include Rails 5.1 system tests and Webpack integration. 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.

With 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, work with popular third-party testing tools such as RSpec, Jasmine, Cucumber, and factory_girl. Test the component parts of a Rails application, including the back-end model logic and the front-end display logic. With Rails examples, use testing to enable your code to respond better to future change. Plus, see how to handle real-world testing situations.

This new edition has been updated to Rails 5.1 and RSpec 3.6 and contains full coverage of new Rails features, including system tests and the Webpack-based JavaScript setup.

What You Need:

Ruby 2.4, Rails 5.1


你的 Rails 代碼是否存在膨脹、脆弱或不準確的問題?通過定期應用測試驅動開發來解決這些問題。你將使用 Rails 5.1、Minitest 5 和 RSpec 3.6,以及流行的測試庫,如 factory_girl 和 Cucumber。更新包括 Rails 5.1 系統測試和 Webpack 整合。按照醫生的建議來改善應用程式的感覺。副作用可能包括更好的代碼、更少的錯誤和更快樂的開發人員。

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

本書通過實際的代碼示例和討論測試的原因,從核心 Ruby on Rails 的基本功能開始。一旦將這些功能整合到你的編碼實踐中,就可以使用流行的第三方測試工具,如 RSpec、Jasmine、Cucumber 和 factory_girl。測試 Rails 應用程式的組件部分,包括後端模型邏輯和前端顯示邏輯。通過 Rails 的示例,使用測試使你的代碼對未來的變化更好地響應。此外,還了解如何處理現實世界的測試情況。

這個新版本已更新到 Rails 5.1 和 RSpec 3.6,並包含對新的 Rails 功能的全面覆蓋,包括系統測試和基於 Webpack 的 JavaScript 設置。

Ruby 2.4、Rails 5.1