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
450
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
Nuxt UI Pro、NuxtHub、Nuxt Scripts、Nuxtエコシステムをふんだんに利用して開発するコーポレートサイト@Vue Fes Japan 2024
shingangan
3
180
Modern Functional Fluent CFML REST by Luis Majano
ortus24
0
160
モジュラモノリス、その前に / Modular monolith, before that
euglena1215
8
750
メルカリ ハロ アプリの技術スタック
atsumo
2
880
Micro Frontends for Java Microservices - dev2next 2024
mraible
PRO
0
230
CSC509 Lecture 07
javiergs
PRO
0
130
2万ページのSSG運用における工夫と注意点 / Vue Fes Japan 2024
chinen
3
440
Folding Cheat Sheet #8
philipschwarz
PRO
0
130
書籍『LangChainとLangGraphによるRAG・AIエージェント[実践]入門』の紹介
os1ma
2
120
Новый уровень ML-персонализации Lamoda: Как мы усилили ее в каталоге и перенесли на другие продукты
lamodatech
0
390
Vitest Browser Mode への期待 / Vitest Browser Mode
odanado
PRO
1
770
(Deep|Web) Link support with expo-router
mrtry
0
190
Featured
See All Featured
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Visualization
eitanlees
143
15k
Building Applications with DynamoDB
mza
90
6k
Designing the Hi-DPI Web
ddemaree
280
34k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
Automating Front-end Workflow
addyosmani
1365
200k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
13
1.8k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
46
2.1k
Optimizing for Happiness
mojombo
375
69k
BBQ
matthewcrist
85
9.2k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
130k
Music & Morning Musume
bryan
46
6.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ωλͨ͘͞Μ͋Δ
͋Γ͕ͱ͏͍͟͝·ͨ͠