Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
RSpecはじめました
Search
kkabetani
October 19, 2013
Programming
2
470
RSpecはじめました
kanazawa.rb meetup #14 で行われたミニコーナー「Test ! Test !! Test !!!」で発表したスライド
kkabetani
October 19, 2013
Tweet
Share
More Decks by kkabetani
See All by kkabetani
kanazawa.rb Slides
kkabetani
0
200
Other Decks in Programming
See All in Programming
20年もののレガシープロダクトに 0からPHPStanを入れるまで / phpcon2024
hirobe1999
0
430
return文におけるstd::moveについて
onihusube
1
1k
Stackless и stackful? Корутины и асинхронность в Go
lamodatech
0
710
rails statsで大解剖 🔍 “B/43流” のRailsの育て方を歴史とともに振り返ります
shoheimitani
2
930
tidymodelsによるtidyな生存時間解析 / Japan.R2024
dropout009
1
770
range over funcの使い道と非同期N+1リゾルバーの夢 / about a range over func
mackee
0
110
コンテナをたくさん詰め込んだシステムとランタイムの変化
makihiro
1
120
Cloudflare MCP ServerでClaude Desktop からWeb APIを構築
kutakutat
1
540
テストコード文化を0から作り、変化し続けた組織
kazatohiei
2
1.5k
Zoneless Testing
rainerhahnekamp
0
120
ゆるやかにgolangci-lintのルールを強くする / Kyoto.go #56
utgwkk
1
370
良いユニットテストを書こう
mototakatsu
5
2k
Featured
See All Featured
The Cult of Friendly URLs
andyhume
78
6.1k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
KATA
mclloyd
29
14k
Facilitating Awesome Meetings
lara
50
6.1k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.2k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
1.2k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
510
Reflections from 52 weeks, 52 projects
jeffersonlam
347
20k
Docker and Python
trallard
42
3.1k
Building an army of robots
kneath
302
44k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
Transcript
34QFD͡Ί·ͨ͠ LBOB[BXBSCNFFUVQ !LLBCFUBOJ
ࣗݾհ w!LLBCFUBOJ w5PZBNB w+BWBͰ8FCΞϓϦ࡞ͬͯ·͢ w+BWB4DSJQUগʑ w3VCZझຯͰ৮ͬͯ·͢
̏ϲ݄લ wʮͨͷ͍͠3VCZʯΛࣸܦͨ͠ w3VCZPO3BJMTͬͯΈΑ͏͔ͳʔ wLBOB[BXBSCʹॳࢀՃͨ͠
34QFDͬͯԿʁ
࠷ۙ w3VCZPO3BJMTͰΞϓϦ࡞͔ͬͨΒςε τॻ͜͏ʢ࣍5%%ͰͬͯΈΑ͏ʣ w(FN࡞ͬͯΈΑ͏ w%4-ʁԿͦΕʁ໘നͦ͏ wLBOB[BXBSCʹࢀՃָͯ͘͠͠ͳͬͯ ͖ͨ
34QFDͪΐͬͱ ͔͖ͬͯͨ
ͦΜͳ͕ࣗ 34QFDͰษڧ͖ͯ͠ ͨ͜ͱΛൃද͠·͢
34QFDͱͷग़ձ͍ w3VCZPO3BJMTνϡʔτϦΞϧͰࣸ ܦͯ͠ษڧͯͨ͠ͱ͖ 3BJMTW wIUUQSBJMTUVUPSJBMKQ
࠷ॳʹॻ͍ͨ34QFD require 'spec_helper' describe "Static pages" do describe "Home page"
do it "should have the content 'Sample App'" do visit '/static_pages/home' page.should have_content('Sample App') end end end
࠷ॳʹॻ͍ͨ34QFD require 'spec_helper' describe "Static pages" do describe "Home page"
do it "should have the content 'Sample App'" do visit '/static_pages/home' page.should have_content('Sample App') end end end
࠷ॳʹॻ͍ͨ34QFD require 'spec_helper' describe "Static pages" do describe "Home page"
do it "should have the content 'Sample App'" do visit '/static_pages/home' page.should have_content('Sample App') end end end
ϯʁφχίϨʁ w3VCZͬΆ͍͚Ͳ w͜Μͳͷशͬͯͳ͍Μ͚ͩͲ wEFTDSJCF wJU wϒϩοΫʁ
࠷ॳͱʹ͔ࣸ͘ܦ͠ ͯಈ͖ΛݟͯΔ͚ͩ
ࣦഊͯ͠ΔͶ
·ͨࣸܦͯ͠࠶࣮ߦ
ޭͨ͠Ͷ
ࣸܦΛ܁Γฦͨ݁͠Ռ wগͮͭ͠34QFDͷ֓ཁ͕͔͖ͬͯͨ wSBJMTͷಈ͖Λॻ͍ͯςετͯ͠Δͩͳ
ٙͨ͘͞Μग़͖ͯͨ
ٙ wͰɺ͜ΕͲ͏͍͏ಈ͖ʹͳͬͯΔ ͷʁ w3VCZͳͷʁ wEFTDSJCFͱ͔JUͱ͔·ͩΑ͔ͬ͘ ͯͳ͍Μ͚ͩͲ
ͦΜͳͱ͖
LBOB[BXBSC w!:VLJNJUTV@*[BXB͞Μͷൃද w3VCZͰ࡞Δ%4- wIUUQXXXTMJEFTIBSFOFU ZJ[BXBSVCZETM
LBOB[BXBSC w34QFD3VCZͰ࣮͞Εͨ෦ %4- w؆୯ͳίʔυͰ%4-Λઆ໌͍ͯͨͩ͠ ͘
%4-ʂʁ
͋ʂ34QFDϒϩο Ϋͯ͠Δͷ͔
3VCZPO3BJMT ͪΐͬͱஔ͍ͱ͍ͯɺ 34QFD %4- ͷษڧ͠ ͯΈΑ͏
34QFDͱԿ͔ʁ wϓϩάϥϜͷৼ CFIBWJPVS Λه ड़͢ΔͨΊͷυϝΠϯಛԽݴޠ %PNBJO4QFDJpD -BOHVBHF%4- Λఏڙ͢ΔϑϨʔ ϜϫʔΫ
ͬͺΓʂ %4-ͳͷ͔ʂʂ
ιʔεಡΜͰΈΑ͏ w͖ͬͱEFTDSJCFؔͰϒϩοΫΛҾ ʹͯ͠Δͱ͜Ζ͕͋Δͣ wEFTDSJCFͰͻͨ͢Β୳͢
ιʔεಡΜͰΈΑ͏ rspec-core/lib/spec/core/dsl.rb def describe(*args, &example_group_block) RSpec::Core::ExampleGroup.describe(*args, &example_group_block).register end
ιʔεಡΜͰΈΑ͏ rspec-core/lib/spec/core/dsl.rb def describe(*args, &example_group_block) RSpec::Core::ExampleGroup.describe(*args, &example_group_block).register end
ιʔεಡΜͰΈΑ͏ wEFTDSJCFؔݟ͚ͭͨ wҾͰϒϩοΫͯ͠Δ w͕͜͜34QFDͷग़ൃ w%4-͕֬ೝग़དྷͨ
͔͖ͬͯͨ describe Bowling, "#score" do it "returns 0 for all
gutter game" do bowling = Bowling.new 20.times { bowling.hit(0)} bowling.score.should eq(0) end end
͔͖ͬͯͨ describe Bowling, "#score" do it "returns 0 for all
gutter game" do bowling = Bowling.new 20.times { bowling.hit(0)} bowling.score.should eq(0) end end
͔͖ͬͯͨ describe Bowling, "#score" do it "returns 0 for all
gutter game" do bowling = Bowling.new 20.times { bowling.hit(0)} bowling.score.should eq(0) end end
͔͖ͬͯͨ wιʔεΛಡΉ͜ͱͰɺEFTDSJCF͕Կ ͯ͠Δ͔͔ͬͨ wJUԿͯ͠Δ͔͔ͬͨ
·ͱΊ w࠷ॳ34QFD͚ͬͯͨͲɺશવͪΜ Μ͔ΜΜͳঢ়ଶ w%4-Λ͔ͬͯΒɺ%4-ʹ͍ͭͯͬ ͱΓͨ͘ͳͬͨ
·ͱΊ wͪΐ͏Ͳͦͷ࣌ɺݟͯͨ34QFD͕ %4-ͩͱ͍͏͜ͱΛΔ wͦΕ͔Βɺ34QFDͷιʔεಡΜͩ Γɺ34QFDʹ͍ͭͯॻ͔Ε͍ͯΔهࣄ ΛಡΈ͋͞Δ w͖͔͚ͬLBOB[BXBSCͩͬͨ
࣍ wࠓΛ͖͔͚ͬʹ࣍ w%4- w34QFDͬͱਂ͘ w3VCZPO3BJMT w#%% 5%% wωλͨ͘͞Μ͋Δ
͋Γ͕ͱ͏͍͟͝·ͨ͠