~/talk

Better code through boring(er) tests

Talkat RedDotRubyConf 2017 · 2017-06-22..06-23· [testing, ruby]
github:bhaibel
slides:none on file

Tests get painful for three concrete reasons: testing private methods (fix by making the method public, extracting a class, or adding test-friendly introspection), duplicated tests across clients/donors (fix by extracting a query class or repository so tests and app code co-evolve), and “inventing the universe” setup (fix by moving important setup into constructors or application-level factory methods, or by using WebMock for external services). Uses minitest/rspec, FactoryGirl, ActiveRecord, mocks/partial mocks; tradeoffs are realism versus focused, fast tests and CI speed.

AI-written summary · about

  1. 0:00Start
  2. 5:06TESTING PRIVATE METHODS - THE PROBLEM
  3. 5:52TESTING PRIVATE METHODS - ALTERNATIVES
  4. 6:28TESTING PRIVATE METHODS - EXTRACT SIMPLE CLASS
  5. 7:12TESTING PRIVATE METHODS - DEFER THE DECISION
  6. 7:55DUPLICATE TESTS - THE PROBLEM
  7. 9:21DUPLICATE TESTS - THE SHARED EXAMPLE GROUP SMELL
  8. 10:26DUPLICATE TESTS - THE DIRECT MODULE TEST SMELL
  9. 10:49DUPLICATE TESTS - THE EXTRACT CLASS FIX
  10. 11:08DUPLICATE TESTS - THE KEY IDEA
  11. 11:45INVENTING THE UNIVERSE - THE PROBLEM
  12. 12:06INVENTING THE UNIVERSE - THE PREMATURE FIX SMELL
  13. 14:08INVENTING THE UNIVERSE - SHARED CONTEXT SMELL
  14. 16:24INVENTING THE UNIVERSE - FACTORY_GIRL SMELL
  15. 20:36A MAGIC TRICK
~/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.