Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Ruby2.1のRefinementsで作るSpockライクなテスト構文
Search
Tomohiro Hashidate
August 23, 2014
Programming
1.6k
12
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Ruby2.1のRefinementsで作るSpockライクなテスト構文
RefinementsをRSpecで活用してパラメータライズドテスト用のシンタックスを実現する話。
Tomohiro Hashidate
August 23, 2014
More Decks by Tomohiro Hashidate
See All by Tomohiro Hashidate
Ruby::Boxでできること、Refinementsでできること
joker1007
3
520
Do Ruby::Box dream of Modular Monolith?
joker1007
1
1.7k
ReproでのicebergのStreaming Writeの検証と実運用にむけた取り組み
joker1007
0
820
マイクロサービスへの5年間 ぶっちゃけ何をしてどうなったか
joker1007
23
11k
Quarkusで作るInteractive Stream Application
joker1007
0
330
今改めてServiceクラスについて考える 〜あるRails開発者の10年〜
joker1007
25
29k
rubygem開発で鍛える設計力
joker1007
5
1.5k
実践Kafka Streams 〜イベント駆動型アーキテクチャを添えて〜
joker1007
3
1.5k
本番のトラフィック量でHudiを検証して見えてきた課題
joker1007
2
1.4k
Other Decks in Programming
See All in Programming
Security issues being discussed on Web Platforms
petamoriken
0
1.4k
iOSDC2026登壇資料.pdf
riofujimon
0
200
WebRTC映像をAirPlayに対応させる挑戦.pdf
monolithic_adam
0
330
コードレビューのボトルネックを"する側"と"される側"の両面から解消する
yub0n
2
1.3k
巨大モノリシックアプリ モダン化大作戦
ktcryomm
1
1.2k
App Intentsのビルドプロセスを支える技術
kntkymt
0
490
スマートフォンでモールス信号を送受信する 〜スマートフォンのLEDとカメラで作る光通信の設計と実装〜
atsuki_seo
0
220
Vue Fes Japan 2026 タイムテーブル徹底解説
448jp
1
590
すこし踏み込む CancellationToken
htkym
2
1.5k
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Rails World 2026, Austin, Texas
marcoroth
0
140
更なる可用性を求めて、5年間運用したKotlinのアプリケーションをGoでリプレイスする話
ken_tunc
0
420
モジュールの視点からSwiftを読み解く #iosdc
s_shimotori
0
290
Featured
See All Featured
Facilitating Awesome Meetings
lara
57
7.2k
Darren the Foodie - Storyboard
khoart
PRO
4
4k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.6k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
340
We Are The Robots
honzajavorek
0
380
Rebuilding a faster, lazier Slack
samanthasiow
85
9.7k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
520
How to Think Like a Performance Engineer
csswizardry
28
2.8k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
310
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
3.2k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
290
Building Flexible Design Systems
yeseniaperezcruz
330
41k
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 !!