Rspec 101

Rspec 101


# 本書內容


* rspec-rails 的使用

* TDD and Red / Green / Refactor

* Unit Test, Functional Test, Integration Test

* One Assertion Principle

* Macros

* Shared Examples

* Feature specs with Capybara

* Stub

* Mock

* Spy with mocha

* Testing Time

* Email Testing

以一個完整的 Rails 討論區的開發作為 TDD 的 Example。


This book is designed for my colleagues but not for sale at the first place.

Therefore, this book is is not granted will be finished at a specify date. And is not refundable.

Please consider these terms before buying this books!



  • 本書內容
  • 本書練習專案
  • 建立一個新專案 groupme
  • 安裝 Rspec
  • 第一章:建立 Group
  • TDD :從寫 Group controller 開始
  • 功能 1.1 : 在 /groups 要能見到所有的 Group
  • 補充 1.1-1: 使用 Fabricator 生假資料
  • 補充 1.1-2: One assertion per test
  • 補充 1.1-3: DAMP Not DRY
  • 功能 1.2 : 在 /groups/1 要能見到 Group 的內容
  • 功能 1.3 : 在 /groups/new 填寫表單
  • 功能 1.4 : 在 /groups/new 填寫表單後送出產生一筆紀錄
  • 補充 1.4-1: 使用 context 整理重複語句
  • 功能 1.5 : 在 /groups/1/edit 修改表單
  • 功能 1.6 : 在 /groups/1/edit 修改表單送出更新原有紀錄
  • 功能 1.7 : 刪除 group 紀錄
  • 總結
  • 第二章:只有註冊會員才能管理 Group
  • 安裝 Devise
  • 功能 2.1 : 使用者必須要登入才能新增 Group
  • 補充:2-1-1 : 使用 macros 簡化重複動作

Leanpub 无条件、无风险的 100% 保证满意

付款之後的 60 天內,只要點個兩下,你就可以完成退書並且取回先前支付的全數金額。退書是採用人工作業,因此可能需要花幾天的時間才能完成整個程序。
See full terms.

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $12 million USDwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers), EPUB (for phones and tablets) and MOBI (for Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

在 Leanpub 上面写作并出版

作者与出版社使用 Leanpub 来出版写作中和已完成的书籍,就像这本书一样。你可以可以用 Leanpub 来撰写、出版和销售你的作品!Leanpub 是功能强大的平台,非常适合认真的作者。它结合了简单、优雅的写作与出版流程,以及一个可销售写作中的电子书的线上商店。Leanpub 对作家而言是个神奇的打自己:紫耀编写纯文本,然后点击按钮就可以出版你的电子书。真的就是这么简单。

学习更多关于如何在 Leanpub 上写作