Spork || How To Streamline Your TDD Process

1,312 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,312
On SlideShare
0
From Embeds
0
Number of Embeds
17
Actions
Shares
0
Downloads
13
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • How many use Rails3? How many practice TDD? How many suffer as result?\n
  • \n
  • \n
  • So you wait 14 seconds for Rails to boot, to run a 0.02 seconds spec. Now try to do it few times every minute.\n
  • So you wait 14 seconds for Rails to boot, to run a 0.02 seconds spec. Now try to do it few times every minute.\n
  • Spork is Tim Harper’s implementation of test server\nSpork runs on POSIX systems using fork. It also runs on windows by pre-populating a pool of ready processes (referred to here as the “magazine” strategy).\nGuard is a command line tool that easily handle events on files modifications.\n\n
  • Why still 3 seconds? Because there are still some things we reload on every run of specs (although this can be probably optimized).\nBesides this, you also save time by not having to run specs manually. So guard-rspec is relevant even if you don't have a big Rails project or non Rails project at all.\n\n
  • Why still 3 seconds? Because there are still some things we reload on every run of specs (although this can be probably optimized).\nBesides this, you also save time by not having to run specs manually. So guard-rspec is relevant even if you don't have a big Rails project or non Rails project at all.\n\n
  • Automatic spec runs\nGrowl notifications\nRe runs your specs until they’re green\n
  • Show spec_helper...\n
  • \n
  • \n
  • \n
  • \n
  • Spork || How To Streamline Your TDD Process

    1. 1. Spork & Guard ||How To StreamlineYour TDD ProcessArik Fraimovich @arikfrRuby Underground, August 2011
    2. 2. The Problem$ time rails runner “puts 1”1real 0m14.917suser 0m10.932ssys 0m3.007s
    3. 3. $ rails new timetest$ cd timetest$ bundle$ time rails runner “puts 1”2.30s user 0.63s system 77% cpu 3.786 total
    4. 4. The Problem$ time rspec ./spec/models/asset_spec.rbFinished in 0.02351 secondsreal 0m19.014suser 0m13.108ssys 0m3.440s
    5. 5. The Problem$ time rspec ./spec/models/asset_spec.rbFinished in 0.02351 secondsreal 0m19.014suser 0m13.108ssys 0m3.440s
    6. 6. The Problem$ time rspec ./spec/models/asset_spec.rbFinished in 0.02351 secondsreal 0m19.014suser 0m13.108ssys 0m3.440s
    7. 7. The SolutionSpork (supports RSpec, Test::Unit, Cucumber)https://github.com/timcharper/sporkGuard https://github.com/guard/guardGuard-Spork https://github.com/guard/guard-sporkGuard-RSpec https://github.com/guard/guard-rspec
    8. 8. $ guard # starts all your “guards” in one command$ time rspec ./spec/models/asset_spec.rbFinished in 0.01704 secondsreal 0m3.046suser 0m0.400ssys 0m0.116s
    9. 9. $ guard # starts all your “guards” in one command$ time rspec ./spec/models/asset_spec.rbFinished in 0.01704 secondsreal 0m3.046suser 0m0.400ssys 0m0.116s
    10. 10. $ guard # starts all your “guards” in one command$ time rspec ./spec/models/asset_spec.rbFinished in 0.01704 secondsreal 0m3.046suser 0m0.400ssys 0m0.116s
    11. 11. Guard-RSpec
    12. 12. Wow, looks simple...
    13. 13. Wow, looks simple...It is, but there are some caveats when usingother gems (Devise, Mongoid, FactoryGirl)Collection of helpful links to help you solve(some of) them:https://gist.github.com/1118210
    14. 14. Other options? IsolationJust don’t run Rails when running specs...
    15. 15. One more thing...
    16. 16. oh-my-zshhttps://github.com/robbyrussell/oh-my-zsh
    17. 17. Questions?

    ×