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

RSpec 勉強会

RSpec 勉強会

Tnishikori

August 08, 2017
Tweet

More Decks by Tnishikori

Other Decks in Technology

Transcript

  1. Y 6 O J U   P S 

     Y 4 Q F D 3
  2. Y 6 O J U ܥ ͱ Y 4 Q

    F D ܥ 4 xUnit xSpec ίϯηϓτ ςετͷظ଴஋ΛಘΔ ͦͷػೳͷৼΔ෣͍͸Ͳ͏Ώ͏ ΋ͷ͔ ॻ͖ํ ؔ਺ɺϝιουͷΑ͏ͳॻ͖ ํ %4-Λ࠾༻͍ͯ͠Δ͜ͱ͕ଟ͍ ֶशίετ ௿͍ ߴ͍ Մಡੑ ಡΈͮΒ͍ ಡΈ΍͍͢
  3. ' J Y U V S F T ͱ '

    B D U P S Z ( J S M 'JYUVSFT ZNMϑΝΠϧʹϨίʔυͮͭॻ͘ 'BDUPSZ(JSMʹൺ΂Δͱ࣮ߦ଎౓͸ૣ͍ 7BMJEBUJPO͸௨Βͳ͍ ΧϥϜ͕૿͑Δͱશ෦ͷϨίʔυΛॻ͖௚͕͠ൃੜ 'BDUPSZ(JSM ιʔείʔυʹςετσʔλΛهࡌ 7BMJEBUJPO͕௨Δ ֶशίετ͕ߴ͍ ຖճ7BMJEBUJPOΛ௨͢ͱ஗͍ 6
  4. 3 4 Q F D ͱ ͸ ϓϩάϥϜͷৼΔ෣͍ #FIBWJPVS Λهड़͢ΔͨΊͷ%4-Λ

    ఏڙ͢ΔϑϨʔϜϫʔΫ ϓϩάϥϜΛॻ͘લʹৼΔ෣͍Λॻ͘#%% ৼ෣ۦಈ։ ൃ Λڧ͘ҙࣝ #%%ͷ໨త͸ɺͦͷιϑτ΢ΣΞ͕࢖ΘΕΔঢ়گΛઆ໌͢ ΔͨΊͷݴޠΛ୯७Խ͢Δ͜ͱͰίϛϡχέʔγϣϯΛޙ ԡ͢͠Δ͜ͱ
 
 8 Given When Then
  5. ج ຊ త ͳ ࢖ ͍ ํ ϑΝΠϧ໊͸ @TQFDSC TQFDҎԼʹςετίʔυΛ௥Ճ͍ͯ͘͠

    STQFDϑΝΠϧ໊Ͱ࣮ߦ DPWBSBJMT౳ͱ૊Έ߹ΘͤΔͱΧόϨοδΛදࣔ͢Δ͜ͱ΋ Ͱ͖Δ STQFDϑΝΠϧʹSTQFDίϚϯυͷΦϓγϣϯΛॻ͍͓ͯ͘ ͜ͱ΋ग़དྷΔ 9
  6. 3 4 Q F D ͷ ॻ ࣜ EFTDSJCFςετͷର৅ɺઆ໌ Ϋϥε໊ɺϝιου໊Λهࡌ͢Δͱ(PPE

    DPOUFYUςετͷ৚݅ dͷ৔߹ɺdͰ͋Δ࣌ JU FYBNQMF ςετͷ಺༰ɺظ଴஋ dͰ͋Δࣄ FYQFDUର৅ͷධՁΛ͢Δ TLJQର৅ͷςετΛεΩοϓ͢Δ 10
  7. ಉ ͡ ς ε τ Λ ά ϧ ʔ ϐ

    ϯ ά TIBSFE@FYBNQMFT@GPSͰςετίʔυΛάϧʔϐϯά ɺ JU@CFIBWFT@MJLFͰάϧʔϓΛݺͼग़͠ DPOUFYUͷάϧʔϐϯά͸TIBSFE@DPOUFYUͱJODMVEF@DPOUFYU Λ࢖͏ 12
  8. M F U   ά ϧ ʔ ϐ ϯ

    ά 4 B N Q M F 13 άϧʔϐϯάΛߦ͏લ άϧʔϐϯάޙ
  9. ς ε τ ͷ લ ॲ ཧ ͱ ޙ ॲ

    ཧ CFGPSFͰલॲཧɺBGUFSͰޙॲཧ TVJUFશςετͷ࣮ߦલޙʹҰճ BMM֤ϒϩοΫ DPOUFYUEFTDSJCF ͷલޙ FBDIશͯͷJUϒϩοΫͷલޙ 14
  10. Α ͘ ࢖ ͏ ຣ ஡ ʔ N B U

    D I F S OPU@ UPFR౳Ձ͔Ͳ͏͔ UPCF CF@FNQUZΦϒδΣΫτ͕ۭͰ͋Δ͔ CF ccc ΦϒδΣΫτʹରͯ͠ͷൺֱ CF@OJMΦϒδΣΫτ͕OJM͔Ͳ͏͔ UPJODMVEF഑ྻ಺ʹσʔλ͕͋Δ͔ 15
  11. 3 4 Q F D ͱ ૊ Έ ߹ Θ

    ͤ Δ ͱ ศ ར STQFDSBJMT 4FMFOJVN 1PMUFSHFJTU $BQZCBSB 17
  12. 3 4 Q F D  3 B J M

    T DPOUSPMMFS UZQFDPOUSPMMFS HFUQPTUQVUEFMFUFΞΫγϣϯ໊ ύϥϝʔλ SFRVFTU UZQFSFRVFTU HFUQPTUQVUEFMFUF63- ύϥϝʔλ WJFX UZQFWJFX SFOEFSͰWJFXϨϯμϦϯά SFOEFSFEͰϨϯμϦϯάͨ͠WJFXऔಘ BTTFSU@TFMFDUΤϨϝϯτIUNMଐੑ஋ʹର͢ΔΞαʔγϣϯ 18
  13. ' B D U P S Z ( J S

    M ͷ ֓ ཁ 19
  14. ' B D U P S Z ( J S

    M ʹ ͭ ͍ ͯ ΦϒδΣΫτ͔Βఆٛͨ͠σʔλΛੜ੒ͯ͘͠ΕΔ ςετσʔλ౤ೖʹ࢖ΘΕΔ ιʔείʔυͰςετσʔλΛఆٛ͢Δ 20
  15. ' B D U P S Z ( J S

    M ͷ ఆ ٛ 21
  16. 24

  17. ࢀ ߟ จ ݙ ࢖͑Δ34QFDೖ໳ɾͦͷ IUUQRJJUBDPNKODIJUPJUFNTECED STQFDΨΠυϥΠϯ IUUQCFUUFSTQFDTPSHKQ 34QFDͷ EFTDSJCFDPOUFYUFYBNQMFJU

    ͷ࢖͍෼͚ IUUQRJJUBDPNVDIJLPJUFNTEDEGG .JOJUFTUͱ3TQFDɺ'JYUVSFTͱ'JDUPSZ(JSMͷൺֱ IUUQCMPHKOJUPDPNFOUSZ 26