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
460
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
190
Other Decks in Programming
See All in Programming
役立つログに取り組もう
irof
25
8.4k
Golang と Erlang
taiyow
8
1.9k
讓數據說話:用 Python、Prometheus 和 Grafana 講故事
eddie
0
340
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
6
2.6k
リリース8年目のサービスの1800個のERBファイルをViewComponentに移行した方法とその結果
katty0324
5
3.5k
From Subtype Polymorphism To Typeclass-based Ad hoc Polymorphism- An Example
philipschwarz
PRO
0
150
CSC509 Lecture 08
javiergs
PRO
0
100
Pinia Colada が実現するスマートな非同期処理
naokihaba
2
140
破壊せよ!データ破壊駆動で考えるドメインモデリング / data-destroy-driven
minodriven
15
3.9k
GitHub Actionsのキャッシュと手を挙げることの大切さとそれに必要なこと
satoshi256kbyte
5
370
約9000個の自動テストの 時間を50分->10分に短縮 Flakyテストを1%以下に抑えた話
hatsu38
22
10k
OpenTelemetryでRailsのパフォーマンス分析を始めてみよう(KoR2024)
ymtdzzz
4
1.5k
Featured
See All Featured
The Language of Interfaces
destraynor
154
24k
Optimizing for Happiness
mojombo
376
69k
Speed Design
sergeychernyshev
24
570
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
13
1.9k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
26
2k
Build The Right Thing And Hit Your Dates
maggiecrowley
32
2.4k
It's Worth the Effort
3n
183
27k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.6k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Statistics for Hackers
jakevdp
796
220k
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ωλͨ͘͞Μ͋Δ
͋Γ͕ͱ͏͍͟͝·ͨ͠