Bug in subject memoization
Created by: exviva
Today I wanted to play around with the new super
powers of let
and subject
, but ran into some issues, exposed in https://github.com/exviva/rspec-core/commit/3041a3b328cd723e911d976de1e5bfc482001d8c.
I'd expect subject
to be memoized and return the same object in before
, let
and it
blocks, but for some reason all the examples from the commit fail, in all 3 contexts.
I thought this would have to do with the recent changes in the way subject
was implemented, but weirdly enough, in v2.12.2, one shared example fails, in all 3 contexts:
its(:object_id) { should eq(subject_id_in_let) }
I tried to find a solution, but no luck, maybe you could help out? I'll gladly submit a proper PR when we find out what's going on.