• Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
1,534
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
72
Comments
0
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide























































Transcript

  • 1. BDD for Rails Legacy Code
  • 2. About Me  Lu Wei Jen  Rails Developer  http://blog.weijen.net  http://www.facebook.com/ weijenlu  Twitter: weijenlu 
  • 3. 10
  • 4. 10
  • 5. Legacy Code
  • 6. Agenda • • BDD • BDD • Legacy Code • Legacy Code
  • 7. • • • •
  • 8. Changes Changes Changes Changes Changes Changes
  • 9. BDD • Behavior Driven Development • •
  • 10. BDD Tools for Rails • Cucumber • Webrat • RSpec
  • 11. Cucumber • • •
  • 12. Cucumber
  • 13. Cucumber
  • 14. Cucumber Mock Object
  • 15. Webrat • • • • form •
  • 16. Webrat: • visit "http://rubyconf.tw" • click_link " "
  • 17. Webrat: Form • file_in " ", :with => "weijen" • check " " • select " ", :from => " " • click_button
  • 18. Webrat: • response.should contain(" ") • response.should have_selector("img.photo")
  • 19. RSpec
  • 20. • • • • •
  • 21. • • •
  • 22. • Waybill model #set_customer • Waybills_controller #create
  • 23. Model
  • 24. Model
  • 25. Mock Object • • • •
  • 26. Mock Object • my_mock = mock(name) • my_mock = mock(name, stubs) • my_mock = mock_model(name, stubs)
  • 27. • my_mock.stub!(:msg).with(args).and_return(value)
  • 28. Message Expectation • my_mock.should_receive(:msg).with(args).and_r eturn(value)
  • 29. Mock
  • 30. Controller
  • 31. Controller
  • 32. Cucumber
  • 33.
  • 34. • +
  • 35. • No Silver Bullet • •
  • 36. Q &A