quattro_4 scribble

scribble 落書き (調べた事をただ落書きする)

RailsCasts #413 Fast Tests pro

#413 Fast Tests (pro) - RailsCasts

  • rspec の方が rake spec より速い
  • bundle binstubsはそんな変わらない
  • zeus
  • エディタなどから特定のテストだけを走らせる
  • rspecのタグ (:focus) などを使う
    • config.filter_run_excluding :slow unless ENV['SLOW_SPECS']
  • rspec -p -> プロファイル
  • config.before(:each) { GC.disable }
    • config.after(:each) { GC.enable }
    • DeferredGabageCollection
  • parallel_tests
    • zeus-parallel_tests
    • database.yml db/test<%= ENV['....'] %>.sqlite3
    • rake parallel:create
    • rake parallel:prepare
    • zeus-parallel_tests init
    • zeus parallel_rspec spec
  • guard
    • guard 'rspec', all_on_start: false, all_after_pass: false, zeus: true, parallel: true, bundler: false
  • overtestingしない
    • validationをfeaturesとかで細かくしすぎない
    • beforeを使いすぎない
    • factory_girlのcraeteをbuildを使う
      • build_stubbed
  • modelのデザインを見直す
    • libに新しいクラスを作る Time
  • vcr

Next topic -> selective testing

良い話

FactoryGirl.build_stubbedはこの話にはあまりなかったが、気にはなる