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
Ruby2.1のRefinementsで作るSpockライクなテスト構文
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Tomohiro Hashidate
August 23, 2014
Programming
1.6k
12
Share
Ruby2.1のRefinementsで作るSpockライクなテスト構文
RefinementsをRSpecで活用してパラメータライズドテスト用のシンタックスを実現する話。
Tomohiro Hashidate
August 23, 2014
More Decks by Tomohiro Hashidate
See All by Tomohiro Hashidate
ReproでのicebergのStreaming Writeの検証と実運用にむけた取り組み
joker1007
0
670
マイクロサービスへの5年間 ぶっちゃけ何をしてどうなったか
joker1007
23
9.9k
Quarkusで作るInteractive Stream Application
joker1007
0
250
今改めてServiceクラスについて考える 〜あるRails開発者の10年〜
joker1007
25
21k
rubygem開発で鍛える設計力
joker1007
4
1.3k
実践Kafka Streams 〜イベント駆動型アーキテクチャを添えて〜
joker1007
3
1.4k
本番のトラフィック量でHudiを検証して見えてきた課題
joker1007
2
1.2k
5分で分かった気になるDebezium
joker1007
1
220
Rustで作るtree-sitterパーサーのRubyバインディング
joker1007
5
1.7k
Other Decks in Programming
See All in Programming
Running Swift without an OS
kishikawakatsumi
0
700
Offline should be the norm: building local-first apps with CRDTs & Kotlin Multiplatform
renaudmathieu
0
170
20260320登壇資料
pharct
0
170
Xdebug と IDE による デバッグ実行の仕組みを見る / Exploring-How-Debugging-Works-with-Xdebug-and-an-IDE
shin1x1
0
350
3分でわかるatama plusのQA/about atama plus QA
atamaplus
0
130
AIエージェントで業務改善してみた
taku271
0
500
実践ハーネスエンジニアリング #MOSHTech
kajitack
7
6.1k
Coding as Prompting Since 2025
ragingwind
0
770
10年分の技術的負債、完済へ ― Claude Code主導のAI駆動開発でスポーツブルを丸ごとリプレイスした話
takuya_houshima
0
2.1k
Rethinking API Platform Filters
vinceamstoutz
0
11k
PHPのバージョンアップ時にも役立ったAST(2026年版)
matsuo_atsushi
0
290
forteeの改修から振り返るPHPerKaigi 2026
muno92
PRO
3
250
Featured
See All Featured
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.4k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.7k
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
97
What's in a price? How to price your products and services
michaelherold
247
13k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
290
Deep Space Network (abreviated)
tonyrice
0
110
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
150
The Pragmatic Product Professional
lauravandoore
37
7.2k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.2k
My Coaching Mixtape
mlcsv
0
97
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
250
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
720
Transcript
Ruby2.1ͷRefinementsͰ࡞Δ SpockϥΠΫͳςετߏจ ڮཱ༑@joker1007
!KPLFS 3VCZ3BJMT4DBMB ! :PLPIBNBSC 4IJCVZBSC "TBLVTBSC 5%%#$
ؔਓͰ͢
None
Refinements
ར༻Λએݴͨ͠ίϯςΩετͰͷΈ ϝιου͕ఆٛ͞ΕΔ
• Ruby 2.0͔ΒՃ (experimental) • Ruby 2.0ͷrefinementsτοϓϨϕϧͷΈ • Ruby 2.1͔Βexperimental͡Όͳ͘ͳͬͨ
• Ruby 2.1͔ΒΫϥεείʔϓͰએݴͰ͖ΔΑ͏ʹͳͬͨ
Ruby 2.1͔Β͜͏ॻ͚Δ
Կ͕خ͍͠ͷ͔
ΈࠐΈΫϥεͷ ϝιουΛ্ॻ͖ͯ͠ ӨڹൣғΛݶఆͰ͖Δ DSLॻ͖์ʂ
࣮ࡍͦΕͳΓʹ੍ݶ͕…
ຊ
RSpec
Spock
Spock Cool !!
RefinementsͰ RSpecΛͦΕͬΆ͘ॻ͘
rspec-parameterized https://github.com/tomykaira/rspec-parameterized
ͦΕͬΆ͍ʂ
None
ԿΛ͍ͬͯΔͷ͔ • binding_of_callerͰݺͼग़͠ݩͷbindingΛऔಘ͢Δ • evalͯ͠ݺͼग़͠ݩͷExampleGroupͷΠϯελϯε Λऔಘ͢Δ • ݺͼग़͠ݩͷΠϯελϯεʹύϥϝʔλʔอ࣋ͷͨ ΊͷΠϯελϯεมΛಈతʹఆٛ͢Δ •
ΦϒδΣΫτΛϥοϓͯ͠Πϯελϯεมʹύϥ ϝʔλʔΛՃ͍ͯ͘͠ • RSpecͷdescribe࣮Ϋϥεͷఆٛͱಉ͡ͳͷͰ using͕ར༻Ͱ͖Δ
ࠇຐज़ͩΒ͚ ͔͠ΈࠐΈϝιουΛ উखʹ࠶ఆٛ ! Ͱusingͯ͠ͳ͍Օॴʹ ҰӨڹແ͠
·ͱΊ
• Ruby 2.1͔ΒRefinementsͷ੍ݶ͕গ͠؇͘ ͳͬͨ • Refinementsϝιουఆٛͷࣗ༝Λ͛ͯ ͘ΕΔ • ΈࠐΈϝιου໊લඃΓΛؾʹͤͣDSLΛ ఆٛͰ͖Δ
• ·ͩusingએݴͷ੍͕ଟ͍ͷͰɺࠓޙͷਐԽʹ ظ
Let’s Refine !!