class Object

Public Instance Methods

command_from(code_lines) click to toggle source
# File lib/rspec/support/spec/library_wide_checks.rb, line 57
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 103
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 61
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[ -w ]
    options << "--disable=gem" if RUBY_VERSION.to_f >= 1.9 && RSpec::Support::Ruby.mri?
    run_ruby_with_current_load_path(command, *options)
  end

  [stdout, strip_known_warnings(stderr), status.exitstatus]
end