Your environment
ruby -v: ruby 3.3.7rdbg -v: 1.11.0
Describe the bug
The debug gem's method in debug/source_repository.rb:38 calls File.exist?, which interferes with RSpec mocks that stub this method for specific file paths. This causes test failures with mock expectation errors when the debug gem is loaded during test execution.
To Reproduce
system('gem install bundler')unlessGem::Specification::find_all_by_name('bundler').any?require'bundler/inline'gemfile(true)dosource'https://rubygems.org'gem'rspec'gem'debug','~> 1.11.0'endrequire'rspec'require'debug'classMyClassdefcheck_if_file_exist?(path)File.exist?(path)endendRSpec.describe"debug gem + File.exist? conflict"dolet(:target_path){"config/session_store.yml"}let(:my_class){MyClass.new}beforedoallow(File).toreceive(:exist?).with(target_path).and_return(true)endit"stubs File.exist? and avoids debug interference"doresult=my_class.check_if_file_exist?(target_path)expect(result).tobetrueendendRSpec::Core::Runner.run([])Expected behavior
A clear and concise description of what you expected to happen.
Your environment
ruby -v: ruby 3.3.7rdbg -v: 1.11.0Describe the bug
The debug gem's method in debug/source_repository.rb:38 calls File.exist?, which interferes with RSpec mocks that stub this method for specific file paths. This causes test failures with mock expectation errors when the debug gem is loaded during test execution.
To Reproduce
Expected behavior
A clear and concise description of what you expected to happen.