~/talk

Foreign API Simulation with Sinatra

Talkat RailsConf 2016 · 2016-05-04..05-06· [ruby, testing]
slides:none on file

Proposes using Sinatra interceptor apps to simulate foreign APIs instead of scattering VCR or Webmock stubs, claiming a single-file, readable service definition plus per-test customize and nesting of interceptors. Implements this by overriding net/http start/finish/request to route matching hosts to Rack::MockRequest/Rack::MockResponse, logs transactions for assertions, and deliberately propagates exceptions (disable show_exceptions enable raise_errors) to simulate host unreachable; roadmap includes Faraday adapter and reusable interceptor traits.

AI-written summary · about

  1. 0:00Intro
  2. 3:40Request Interceptor and Rack
  3. 5:35Sinatra Basics
  4. 6:45Request Interceptor Definition
  5. 7:49Intercepting HTTP Request
  6. 8:25Request Logging
  7. 8:52Asserting on the Request and Response Data
  8. 10:52Customizing Request Interceptors
  9. 14:43Simulating Network Errors
  10. 16:10Utilizing Advanced Sinatra Features
  11. 17:59Request Interceptor Core
  12. 19:48Caching the Original Methods
  13. 20:48Overriding Methods
  14. 21:38Requestinterceptor request
  15. 23:58Restoring the Original Methods
  16. 25:24Error Propagation
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.