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
Rack::ClientSpec
Search
Harukasan
PRO
November 17, 2014
Technology
810
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Rack::ClientSpec
Rack::ClientSpec can test your client behavior
社内勉強会用資料
Harukasan
PRO
November 17, 2014
More Decks by Harukasan
See All by Harukasan
Harucom Follow-up
harukasan
PRO
1
52
Building a Standalone Programming Environment
harukasan
PRO
1
2.2k
Successor to PicoRabbit: Ruby Programming Envorinment / RubyKaigi 2025 follow up
harukasan
PRO
1
1.4k
Write your own mrbgem, Create your own device
harukasan
PRO
1
480
PicoRabbit: a Tiny Presentation Device Powered by Ruby
harukasan
PRO
2
1.9k
pixivを支える技術 / 技育CAMPアカデミア
harukasan
PRO
3
640
20240401 新卒研修 - ピクシブにおける技術領域
harukasan
PRO
1
970
ピクシブのコンテンツ配信基盤技術 / pixiv TECH SALON
harukasan
PRO
5
6k
Goにおける画像ファイル処理 / golang.tokyo #19
harukasan
PRO
7
6.9k
Other Decks in Technology
See All in Technology
[2026 Oracle Technical Deep Dive] AI時代のアプリケーションを支えるCloud NativeとJava EEモダナイゼーション (2026年9月17日開催)
oracle4engineer
PRO
0
110
高負荷プロダクション環境におけるAWS Lambdaのリアル 〜スケールとコストを左右する実行ライフサイクルの技術仕様〜
maimyyym
2
850
私の推しは「聞いてから進む」AIです -AI-DLCに一人でアプリを作らせた話
yama3133
1
160
『GOエコノミー 』(相乗りサービス) におけるスペック駆動開発
mot_techtalk
1
260
企業の現実世界をグラフで写し取る
sansantech
PRO
0
250
AI臭い文章とは何なのか
nasuvitz
38
78k
覗いてみよう 関数型ビジュアル言語×2Dグラフィックスの世界
yohyamasaki
0
170
GitHub Agentic Workflows を触ってみる
htkym
2
920
Google Cloud Next Tokyo 26登壇時のスクリプト
recruitengineers
PRO
0
150
AI時代だからこそ推したい!Gitコマンド再入門
munakata
0
100
AIアプリを使い分けるための共通ツール基盤を考えてみる#devio2026
osawa
0
170
KanaAI
shreyas1009
0
140
Featured
See All Featured
Utilizing Notion as your number one productivity tool
mfonobong
4
610
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
900
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.6k
The Limits of Empathy - UXLibs8
cassininazir
1
700
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
310
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
560
Scaling GitHub
holman
464
140k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
780
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
250
Rails Girls Zürich Keynote
gr2m
96
14k
Embracing the Ebb and Flow
colly
88
5.2k
Transcript
Rack::ClientSpec @harukasan / Δ͔͞Μ
ωλͳͷͰਅʹड͚͍͚ͯͳ͍
Web is based on a browser • Web͍͍ͩͨϒϥβ͕ਖ਼͍͜͠ͱ͕લఏʹͳ͍ͬͯΔ • ϒϥβ͕HTTP/HTML/CSS/JSΛ࣮ͯ͘͠ΕͯΔ͓͔͛Ͱ
ΒαʔϏεΛఏڙͰ͖Δ • ϒϥβ੍࡞ऀʹ಄͕͕͋Βͳ͍
Some clients are in the blackbox • ͱ͍͑શͯͷΫϥΠΞϯτͷڍಈ͕Θ͔ͬͯΔΘ͚Ͱͳ͍ • ISUCONͩͱΫϥΠΞϯτͷڍಈṖ
E2E test for server Server Mock send a request get
a response
Capybara it "returns 200" do visit '/' expect(page).to have_content 'Success'
end
Test a client
Test a client Mock Client send a response (if you
need) get a request
Rack::ClientSpec rubygems.org/gems/rack-client_spec
Rack::ClientSpec • ΫϥΠΞϯτͷڍಈΛαʔό͔ΒςετͰ͖Δ • Rack MiddlewareͳͷͰRackΠϯλʔϑΣʔεͳΒ͍͍ͩͨΈࠐΊΔ • Θ͟Θ͟ϞοΫΛͭ͘Βͳͯ͘αʔόʹΈࠐΊͯศར • power_assertศར
github.com/harukasan/rack-client_spec
Insert ClientSpec to your rack Server Client send a response
(if you need) get a request ClientSpec
Insert ClientSpec to your rack app require 'rack' require 'rack/lobster'
require 'rack/client_spec' require 'rack/lobster_spec' use Rack::ClientSpec, LobsterSpec # <- Insert Clientspec run Rack::Lobster.new
Write a test case require 'rack/client_spec' class LobsterSpec < Rack::ClientSpec::TestCase
# <-- test case def test_flip # <-- test method get '/' do |req, res| # <-- expect request assert { res.status == 200 } end get '/?flip=left' do |req, res| # <-- expect request assert { req['HTTP_REFERER'] == 'http://localhost:9292/' } end end end
TODO • ϦΫΤετͷ్தʹ༨ܭͳϦΫΤετ͕དྷΔͱ͚͜ΔͷΛͳ͓͢ • ϦΫΤετ͕དྷͳ͍͜ͱΛςετ͍ͨ͠ • Cache-Controlςετ͍ͨ͠ • όάϑΟοΫε