Class: Object

### Home Classes Methods

### In Files

- lib/rspec/support/spec.rb
- lib/rspec/support/spec/library_wide_checks.rb
- lib/rspec/support/spec/string_matcher.rb

### Parent

BasicObject

### Methods

- #check_for_extra_spaces
- #check_for_tab_characters
- #command_from
- #expected_encoding?
- #have_successful_no_warnings_output
- #load_all_files

### Included Modules

- RSpecHelpers
- RSpec::Support::WithIsolatedStdErr
- RSpec::Support::FormattingSupport
- RSpec::Support::InSubProcess
- RSpec::Support::ShellOut

### 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::ObjectFormatter
- 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::WithIsolatedStdErr
- Object
- RSpecHelpers

No matching classes.

# Object

### Public Instance Methods

check_for_extra_spaces(filename) click to toggle source

    # File lib/rspec/support/spec/library_wide_checks.rb, line 116
    def check_for_extra_spaces(filename)
      failing_lines = []
      File.readlines(filename).each_with_index do |line, number|
        next if line =~ /^\s+#.*\s+\n$/
        failing_lines << number + 1 if line =~ /\s+\n$/
      end

      return if failing_lines.empty?
      "#{filename} has spaces on the EOL on lines #{failing_lines.join(', ')}"
    end

check_for_tab_characters(filename) click to toggle source

This malformed whitespace detection logic has been borrowed from bundler: github.com/bundler/bundler/blob/v1.8.0/spec/quality_spec.rb

    # File lib/rspec/support/spec/library_wide_checks.rb, line 106
    def check_for_tab_characters(filename)
      failing_lines = []
      File.readlines(filename).each_with_index do |line, number|
        failing_lines << number + 1 if line =~ /\t/
      end

      return if failing_lines.empty?
      "#{filename} has tab characters on lines #{failing_lines.join(', ')}"
    end

command_from(code_lines) click to toggle source

    # File lib/rspec/support/spec/library_wide_checks.rb, line 27
    def command_from(code_lines)
      code_lines.join("\n")
    end

expected_encoding?() click to toggle source

Depends on chaining :with_same_encoding for it to check for string encoding.

    # File lib/rspec/support/spec/string_matcher.rb, line 24
    def expected_encoding?
      if defined?(@expect_same_encoding) && @expect_same_encoding
        actual.encoding == expected.encoding
      else
        true
      end
    end

have_successful_no_warnings_output() click to toggle source

    # File lib/rspec/support/spec/library_wide_checks.rb, line 75
    def have_successful_no_warnings_output
      eq ["", "", 0]
    end

load_all_files(files, preamble, postamble=nil) click to toggle source

    # File lib/rspec/support/spec/library_wide_checks.rb, line 31
    def load_all_files(files, preamble, postamble=nil)
      requires = files.map { |f| "require '#{f}'" }
      command  = command_from(Array(preamble) + requires + Array(postamble))

      stdout, stderr, status = with_env 'NO_COVERAGE' => '1' do
        options = ] -w ]
        options << "--disable=gem" if RUBY_VERSION.to_f >= 1.9 && RSpec::Support::Ruby.mri?
        run_ruby_with_current_load_path(command, *options)
      end

      # Ignore bundler warning.
      stderr = stderr.split("\n").reject { |l| l =~ %{bundler/source/rubygems} }.join("\n")
      [stdout, stderr, status.exitstatus]
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.