"RSpec no longer works with ActiveRecord"
summary
A regression causes RSpec mocks to raise when stubbing ActiveRecord scopes because code calls define_attribute_methods on ActiveRecord::Base which explodes for abstract base classes; reproduction shows tests pass on 3.2.0 and fail on 3.2.0→3.3.0; debugging uses a cloneable app, full Gemfile.lock and git bisect across rspec-rails and rspec-mocks, hitting a deleted object_inspector helper and a commit that added the unsafe callback; the fix is a simple guard avoiding Base and a followup generic patch and tests, the bisection takes far longer than the five minute patch.
AI-written summary · about
chapters (22)
- 0:00Start
- 4:13Back to our issue
- 5:56A Steps to reproduce A Ruby Version
- 9:00Open source is collaborative
- 9:38We're still missing something
- 10:15Let's actually debug this
- 14:15We could start debugging here
- 15:08git bisect start
- 18:31git checkout HEAD
- 20:43Same thing, but with RSpec mocks
- 21:47Bisecting old code can be a dangerous mess
- 25:12Active Record::Base .define_attribute_methods
- 25:49Aftermath
- 26:24RSpec rails was critically broken
- 27:39Pro-tips
- 27:55Telling the maintainer there is a bug
- 28:20Providing a backtrace
- 28:44Providing dependency information
- 29:11Providing a reproduction case to clone
- 29:48Bisecting to an exact commit
- 31:41My team is hiring
- 32:35Recording and Production Confreaks








