~/talk

Extremely Defensive Coding

Talkat ArrrrCamp 2015 · 2015-10-01..10-02· [ruby, testing]
slides:none on file

RSpec saves and restores real method implementations to make stubbing reliable across weird Ruby code and interpreters. It builds a robust method retrieval (aspect_support_method_handle_for) that grabs Kernel.instance_method(:method), attempts rebinding, falls back to calling the object method and validates the result, a trust but verify strategy. It defends against objects that redefine method send or is_a? and against odd inheritance like SimpleDelegator, and supports 1.8.7 and JRuby (and Windows CI) so stubs actually get undone.

AI-written summary · about

  1. 0:00Start
  2. 8:41User story
  3. 11:20How do you save a method?
  4. 15:43Instance method object Method without a target object
  5. 18:09Rebinding module methods
  6. 21:53Solution: trust but verify
  7. 26:32Write defensively, and your users will never know what's inside the box
~/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.