Open GCorbel opened 4 months ago
I’m skeptical, however, to include it for everyone. There might be some performance impact, and since this can introduce flakiness due to the GC race condition and an exception is not reassuring.
I understand your worries. I would like to find a better solution but wasn't able.
Maybe we can use a config as excluded_stubbed_const_from_subclasses
or enable it by default and do a config as thread_safe_garabage_collection
?
The more I think, the more I'm in favor of a config flag. Maybe a warning message that say the flag have to be switched should be displayed when there is an error.
I support your idea of opting in for this with a flag.
We could conditionally require weakref if this option is on.
Should we have the option on by default ?
No. But we’re working in RSpec 4, and we can think about enabling it there unless performance considerations come up.
I change to run specs only for Ruby 3.1 and ahead as in https://github.com/rails/rails/blob/v7.0.8/activesupport/lib/active_support/ruby_features.rb
Sorry, my latest commit was completely broke. I fixed it.
I fixed the code for Ruby <= 2.4
The CI pass except for "ruby-head" which is not to my commit
I fixed a flap on specs. Now the CI should pass.
I finally succeeded to install Ruby 3.4-dev locally and confirm that the error on the CI is not related to the PR. It also fail on the main branch.
Hello, I don't want to bother you but is it possible to have a quick review, at least on the global behavior? I'm waiting for this to be able to move forward on the project I'm working on.
Please accept my apologies for the wait. The code is mostly good, thanks!
No problem, it's open source. You don't even have to reply.
@JonRowe can you give a look at this request ?
This fix https://github.com/rspec/rspec-mocks/issues/1568.
Stubbed classes are excluded from parent subclasses after each spec.
The original issue :
Now,
Something.subclasses
always return[B, A]
.