Upgrade to Pro — share decks privately, control downloads, hide ads and more …

TDDとVimと

Yuta Totz
October 23, 2015

 TDDとVimと

RailsまわりのTDDと、Vimについて。

Yuta Totz

October 23, 2015
Tweet

More Decks by Yuta Totz

Other Decks in Programming

Transcript

  1. Resume • Introduction • What is “test”? • TDD on

    Red-Green-Refactor Cycle • TDD by Vim • Demo • Conclusion • Links and Books
  2. Categories of Tests • Unitςετ • ૄ݁߹తͳUnit͝ͱͷ࠴຿Λอূ͢Δ • associationͷਖ਼͠͞ͷ୲อ •

    Featureςετ • Unitؒͷ݁߹ • => ػೳશମͱͯ͠ͷಈ͖ͷਖ਼͠͞Λอূ͢Δ • Model, Controller, ViewΛ۲ࢗ͠Ͱ͖Δʂ
  3. Testing Frameworks • Minitest • Railsඪ४ (DHHਞ) • ೔ຊͰ΋࠷ۙͪΐͬͱ࢖͏ਓ૿͖͑ͯͨ •

    RSpec • ͳΜ͔Ή͠Ζඪ४Έ͍ͨʹͳͬͯͨ • ൈຊతͳ࢓༷มߋ͕ಘҙ
  4. 3 Principles of Writing Tests • ςετ͸৴པͰ͖Δ΋ͷͰ͋Δ͜ͱ • ςετ͸؆୯ʹॻ͚Δ͜ͱ •

    ςετ͸؆୯ʹཧղͰ͖Δ͜ͱ ref. Everyday Rails - RSpecʹΑΔRailsςετೖ໳ - Aaron Sumner, Junichi Ito, AKIMOTO Toshiharu, ৼߐ ڕ
  5. Flow of TDD on Red-Green-Refactor Cycle 1. ςετͰઃܭॻΛॻ͘ (RED) 2.

    ࠷଎͔ͭ࠷΋؆୯ʹςετΛ௨͢ίʔυΛॻ͘ (GREEN) • ͍ͭ͜͸ςετίʔυͷςετ 3. ϦϑΝΫλϦϯά (Refactor) • ͜Ε͕ຊؾͷ࣮૷ • “ϦϑΝΫλϦϯά”ͬͯ΍ͭͱ͸ͪΐͬͱҧ͏ • Red͕ΘΔ͍ɺGreen͕Α͍Ͱ͸ͳ͍ʂ ref. cookpad 2015 summer internship TDD by Yoshiori SHOJI
  6. Vim

  7. Demo $ rails new coedotask $ rails g scaffold Task

    name:string time:integer • λεΫ؅ཧΞϓϦέʔγϣϯ - coedotask • ͜Εʹ Task.calc_total_time Λ௥Ճ͠·͢ʂ
  8. Flow of TDD on Red-Green-Refactor Cycle 1. ςετͰઃܭॻΛॻ͘ (RED) 2.

    ࠷଎͔ͭ࠷΋؆୯ʹςετΛ௨͢ίʔυΛॻ͘ (GREEN) • ͍ͭ͜͸ςετίʔυͷςετ 3. ϦϑΝΫλϦϯά (Refactor) • ͜Ε͕ຊؾͷ࣮૷ • “ϦϑΝΫλϦϯά”ͬͯ΍ͭͱ͸ͪΐͬͱҧ͏ • Red͕ΘΔ͍ɺGreen͕Α͍Ͱ͸ͳ͍ʂ ref. cookpad 2015 summer internship TDD by Yoshiori SHOJI