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
WebフロントエンドにおけるGraphQL(あるいはバックエンドのAPI)との向き合い方 / #241106_plk_frontend
izumin5210
4
1.4k
Laravel や Symfony で手っ取り早く OpenAPI のドキュメントを作成する
azuki
1
110
Kaigi on Rails 2024 〜運営の裏側〜
krpk1900
1
190
Make Impossible States Impossibleを 意識してReactのPropsを設計しよう
ikumatadokoro
0
170
Better Code Design in PHP
afilina
PRO
0
120
.NET のための通信フレームワーク MagicOnion 入門 / Introduction to MagicOnion
mayuki
1
1.4k
聞き手から登壇者へ: RubyKaigi2024 LTでの初挑戦が 教えてくれた、可能性の星
mikik0
1
130
ECS Service Connectのこれまでのアップデートと今後のRoadmapを見てみる
tkikuc
2
250
LLM生成文章の精度評価自動化とプロンプトチューニングの効率化について
layerx
PRO
2
190
役立つログに取り組もう
irof
28
9.6k
Content Security Policy入門 セキュリティ設定と 違反レポートのはじめ方 / Introduction to Content Security Policy Getting Started with Security Configuration and Violation Reporting
uskey512
1
520
シェーダーで魅せるMapLibreの動的ラスタータイル
satoshi7190
1
480
Featured
See All Featured
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
The Language of Interfaces
destraynor
154
24k
Designing the Hi-DPI Web
ddemaree
280
34k
Visualization
eitanlees
145
15k
A Philosophy of Restraint
colly
203
16k
A Tale of Four Properties
chriscoyier
156
23k
Speed Design
sergeychernyshev
24
610
Designing for Performance
lara
604
68k
Automating Front-end Workflow
addyosmani
1366
200k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.3k
What's new in Ruby 2.0
geeforr
343
31k
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ωλͨ͘͞Μ͋Δ
͋Γ͕ͱ͏͍͟͝·ͨ͠