Instant RSpec Test - Driven Development How-to
暫譯: 即時 RSpec 測試驅動開發實用指南
Charles Feduke
- 出版商: Packt Publishing
- 出版日期: 2013-07-04
- 售價: $1,020
- 貴賓價: 9.5 折 $969
- 語言: 英文
- 頁數: 68
- 裝訂: Paperback
- ISBN: 1782165223
- ISBN-13: 9781782165224
-
相關分類:
Ruby
海外代購書籍(需單獨結帳)
買這商品的人也買了...
-
$2,050$1,948 -
$1,750$1,663
商品描述
Learn RSpec and redefine your approach towards software development
Overview
- Learn something new in an Instant! A short, fast, focused guide delivering immediate results
- Learn how to use RSpec with Rails
- Easy to read and grok examples
- Write idiomatic specifications
In Detail
RSpec is a behaviour driven development framework for Ruby programmers. It comes integrated with its own mocking framework based on Jmock. This book introduces you to RSpec helping you to write idiomatic specifications for Ruby code in a test first approach.
Instant RSpec Test-Driven Development How-to is filled with examples of actual code accompanied by explanations and covers general Ruby, Rails, and RSpec use cases plus a few of the more advanced topics. RSpec Test Driven Development is written on the premise that you will need no experience with RSpec and limited experience with Ruby, Rails, and TDD fundamentals. You’ll begin by writing a very simple Ruby library in true TDD fashion and and use the red, green, refactor tools to migrate this library into a Rails application.
Instant RSpec Test-Driven Development How-to will teach you the actual steps performed in writing an idiomatic specification. You will be able to write a test for the code you wish you had, and learn to write only the minimum code necessary to pass a test, and write more specifications to drive out the production functionality your application will need. Through the course of the book, you will convert a Ruby program into a new Rails application, test Rails specifics such as file uploads, cookies, and model validation and even learn how to use Capybara. RSpec Test Driven Development will help you build confidence in the code they you write and spend less time dealing with bugs and maintenance headaches.
What you will learn from this book
- RSpec fundamentals
- How to use RSpec and Rails together
- Modify your behavior to create tests first and run your specs with every code change
- How to work with the rspec command line tool
- Using mocks and stubs to decouple tests from the database
- How to refactor code to improve readability
Approach
Filled with practical, step-by-step instructions and clear explanations for the most important and useful tasks. A concise guide that delivers immediate results with practical recipes on learning practical hints.
Who this book is written for
This book is aimed at Ruby developers with beginner level expertise who want to use RSpec and test driven development methodology to improve the code they write. Experienced programmers new to Ruby will also benefit from this book which also covers creating testable, idiomatic Ruby code.
商品描述(中文翻譯)
學習 RSpec,重新定義您的軟體開發方法
概述
- 立即學習新知!一本短小、快速、專注的指南,提供即時結果
- 學習如何將 RSpec 與 Rails 結合使用
- 易於閱讀和理解的範例
- 撰寫慣用的規範
詳細內容
RSpec 是一個為 Ruby 程式設計師設計的行為驅動開發框架。它內建了基於 Jmock 的模擬框架。本書將介紹 RSpec,幫助您以測試優先的方式撰寫 Ruby 代碼的慣用規範。
《Instant RSpec Test-Driven Development How-to》充滿了實際代碼的範例,並附有解釋,涵蓋一般的 Ruby、Rails 和 RSpec 使用案例,以及一些更高級的主題。RSpec 測試驅動開發的前提是您不需要有 RSpec 的經驗,對 Ruby、Rails 和 TDD 基礎知識的經驗也有限。您將從以真正的 TDD 方式撰寫一個非常簡單的 Ruby 函式庫開始,並使用紅色、綠色、重構工具將此函式庫遷移到 Rails 應用程式中。
《Instant RSpec Test-Driven Development How-to》將教您撰寫慣用規範的實際步驟。您將能夠為您希望擁有的代碼撰寫測試,並學會僅撰寫通過測試所需的最小代碼,並撰寫更多規範以驅動您的應用程式所需的生產功能。在本書的過程中,您將把一個 Ruby 程式轉換為一個新的 Rails 應用程式,測試 Rails 特定功能,如檔案上傳、Cookies 和模型驗證,甚至學習如何使用 Capybara。RSpec 測試驅動開發將幫助您建立對所撰寫代碼的信心,並減少處理錯誤和維護問題的時間。
您將從本書學到的內容
- RSpec 基礎知識
- 如何將 RSpec 和 Rails 一起使用
- 修改您的行為以先撰寫測試,並在每次代碼變更時運行規範
- 如何使用 rspec 命令行工具
- 使用模擬和存根將測試與資料庫解耦
- 如何重構代碼以提高可讀性
方法
本書充滿了實用的逐步指導和對最重要和有用任務的清晰解釋。一本簡明的指南,提供即時結果,並提供實用的學習提示。
本書的讀者對象
本書針對具有初學者水平專業知識的 Ruby 開發人員,旨在幫助他們使用 RSpec 和測試驅動開發方法來改善所撰寫的代碼。對 Ruby 新手的經驗豐富程式設計師也將從本書中受益,因為本書還涵蓋了如何創建可測試的慣用 Ruby 代碼。