Guirec Corbel

Results 127 comments of Guirec Corbel

I tried on a Rails project and doing a garbage collection is not enough. Defined classes without `stub_const` are correctly removed and those that use `stub_const` aren't.

> What do you mean "correctly removed"? I mean, `Something.subclasses` have to be the same for each spec. I edited the ticket's description. `RSpec::Mocks.space.instance_variable_get(:@constant_mutators)` gives : ``` [#] ``` `Object.send(:remove_const,...

Defining the class in a global variable fix the issue : ``` class Something; end describe 'Test' do before(:each) do class A < Something; end $b ||= Class.new(Something) stub_const('B', $b)...

@pirj can you confirm this is a bug or, at least, something that is supposed to be handled in rspec-mocks ?

> But why subclasses show that there are two bound to consts with identical names? It doesn't surprise me that much. Every `Class.new` is referenced as a completely different class...

> So we’re now at a point where we see that tge GC is involved, and yet-to-be-collected classes still appear through subclasses even though are not anymore referenced or even...

> Also, the classes stubbed in an example should be returned by subclasses while the example runs, right? We should push them to the exclude list after teardown. Yes, that's...

I succeeded to fix my issue with : ``` diff --git a/lib/rspec/mocks.rb b/lib/rspec/mocks.rb index 297779e5..b2beb79c 100644 --- a/lib/rspec/mocks.rb +++ b/lib/rspec/mocks.rb @@ -101,6 +101,23 @@ module RSpec end end + @@excluded_subclasses...

You seems to be right. This is because I use neovim. It seems to work with vim 7.4 on my system too. I'm under Linux Mint.

Ruby is enabled for vim but nvim is completely different. I think it's normal for nvim for the moment.