~/talk

Injecting Dependencies for Fun and Profit

Talkat RubyConf 2019 · 2019-11-18..11-20· [ruby]
slides:none on file

Concrete examples show constructor-based injection replacing globals, with tests using RSpec verifying doubles via instance_double and allow/expect; failure behavior is exercised by having the weather service raise a NoPredictionAvailable error and asserting the fallback speech or mailer output. The talk contrasts this with partial mocking/monkeypatching, explains why explicit dependency lists aid comprehension and testing, and shows Rails-friendly service objects and mailer wiring — the presenter mentions using it across about 40 Rails apps.

AI-written summary · about

  1. 0:00Start
  2. 0:33Dependency Injection's Benefits
  3. 0:55Intro to Dependency Injection
  4. 13:51Wait, Why Didn’t We Partially Mock?
  5. 18:06How Do I Inject Dependencies in Rails?
  6. 22:02Takeaways
  7. 22:40Sad Paths are Part of Your UX
  8. 22:55Explicit Dependencies Help You Know Your Code
  9. 23:19Dependency Injection is Possible & Useful in Rails
~/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.