Module: RSpec::Support::WarningsPrevention

### Home Classes Methods

### In Files

- lib/rspec/support/spec/prevent_load_time_warnings.rb

### Methods

- #files_to_require_for

### Class/Module Index

Quicksearch

- RSpec
- RSpec::CallerFilter
- RSpec::Support
- RSpec::Support::BlockSignature
- RSpec::Support::Differ
- RSpec::Support::DirectoryMaker
- RSpec::Support::EncodedString
- RSpec::Support::FormattingSupport
- RSpec::Support::FuzzyMatcher
- RSpec::Support::HunkGenerator
- RSpec::Support::InSubProcess
- RSpec::Support::LooseSignatureVerifier
- RSpec::Support::LooseSignatureVerifier::SignatureWithKeywordArgumentsMatcher
- RSpec::Support::MethodSignature
- RSpec::Support::MethodSignatureVerifier
- RSpec::Support::OS
- RSpec::Support::RecursiveConstMethods
- RSpec::Support::Ruby
- RSpec::Support::RubyFeatures
- RSpec::Support::ShellOut
- RSpec::Support::Spec
- RSpec::Support::StdErrSplitter
- RSpec::Support::StrictSignatureVerifier
- RSpec::Support::Version
- RSpec::Support::VersionChecker
- RSpec::Support::Warnings
- RSpec::Support::WarningsPrevention
- RSpec::Support::WithIsolatedStdErr
- Object
- RSpecHelpers

No matching classes.

# RSpec::Support::WarningsPrevention

### Public Instance Methods

files_to_require_for(lib, sub_dir) click to toggle source

    # File lib/rspec/support/spec/prevent_load_time_warnings.rb, line 6
    def files_to_require_for(lib, sub_dir)
      slash         = File::SEPARATOR
      lib_path_re   = /#{slash + lib}[^#{slash}]*#{slash}lib/
      load_path     = $LOAD_PATH.grep(lib_path_re).first
      directory     = load_path.sub(/lib$/, sub_dir)
      files         = Dir["#{directory}/**/*.rb"]
      extract_regex = /#{Regexp.escape(directory) + File::SEPARATOR}(.+)\.rb$/

      # We sort to ensure the files are loaded in a consistent order, regardless
      # of OS. Otherwise, it could load in a different order on Travis than
      # locally, and potentially trigger a "circular require considered harmful"
      # warning or similar.
      files.sort.map { |file| file[extract_regex, 1] }
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.