Steps to reproduce
Nest travel_to calls e.g.
travel_to 2.days.ago do
travel_to 3.days.ago do
...
end
# boom here when travel_back is invoked
end
Of course I probably shouldn't nest travel_to, but it can happen in more complex test setup code when creating dependent objects over time.
Expected behavior
On the inside travel_back we should return to the outside travel_to, without affecting any of the stubs made by the outside block
Actual behavior
The inside unstubbing removes the stubs from the outside travel_to (speculation founded on some debugging and my sketchy understanding of the debugging process). When the outside tries to unstub we get undefined methods.
System configuration
Rails 4.2.5.1
Ruby version:
ruby 2.1.8p440 (2015-12-16 revision 53160) [x86_64-darwin15.0]