Your SlideShare is downloading. ×
Rails automatic test driven development
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.

Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Rails automatic test driven development


Published on

Rails automatic test driven development

Rails automatic test driven development

Published in: Technology
1 Comment
No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. Rails Automatic Test Driven Development• About the author• Test Driven Development• Testing for Rails• RSpec & Capybara• Spork & Guard• Test inside Sublime Text• Show time• References• Q&A
  • 2. About the author• Tyler Long (龙泰勒)• 6 years of software development experience• 2 years as Senior Software Development Manager• Home page:• @龙泰勒• Github:• Bitbucket:
  • 3. Test Driven Development - 1• Three laws of TDD – First Law: You may not write production code until you have written a failing unit test. – Second Law: You may not write more of a unit test than is sufficient to fail, and not compiling is failing. – Third Law: You may not write more production code than is sufficient to pass the current failing test.
  • 4. Test Driven Development - 2• The TDD Cycle – We first write a failing test, represented in many testing tools by the color red. – We then implement code to get the test to pass, represented by the color green. – Finally, if necessary, we refactor the code, changing its form without changing its function. – This cycle is known as “Red, Green, Refactor”.
  • 5. Testing for Rails• Test::Unit – lightweight and straightforward• RSpec (my choice) – has a lot of stuff which makes testing easier• Cucumber – good for making sure all these sort of high-level features and functionalities are covered
  • 6. RSpec & Capybara• RSpec – RSpec is designed to make Test-Driven Development a productive and enjoyable experience –• Capybara – Capybara makes it easy to simulate how a user interacts with your application. –
  • 7. Spork & Guard• Spork – A DRb server for testing frameworks (RSpec / Cucumber currently) that forks before each run to ensure a clean testing state. –• Guard – Guard is a command line tool to easily handle events on file system modifications –
  • 8. Test inside Sublime Text• Sublime Text – Sublime Text is a sophisticated text editor for code, html and prose. – I switched from Vim to Sublime Text• Run tests directly inside the editor, doesn’t it sound cool? – tests
  • 9. Show Time - 1
  • 10. Show Time - 2
  • 11. References• Ruby on Rails Tutorial: pages?version=3.2• The true meaning of TDD:• Rails TDD (In Chinese):
  • 12. Q&A• Any Questions?