Sha256: 368627b9f0c9cfa934d13b26bd1ef7a3bc3385e16e5f81bbf6f09ec34d6c71c1

Contents?: true

Size: 757 Bytes

Versions: 5

Compression:

Stored size: 757 Bytes

Contents

# encoding: utf-8

# As much as possible, we try to reuse RuboCop's spec environment.
require File.join(
  Gem::Specification.find_by_name('rubocop').gem_dir, 'spec', 'spec_helper.rb'
)

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'rubocop-rspec'

# Overwriting RuboCop's parse_source to add support for mocked file paths.
#
# Remove once rubocop > 0.17.0 releases.
def parse_source(source, file = nil)
  source = source.join($RS) if source.is_a?(Array)
  if file.is_a? String
    Rubocop::SourceParser.parse(source, file)
  elsif file
    file.write(source)
    file.rewind
    Rubocop::SourceParser.parse(source, file.path)
  else
    Rubocop::SourceParser.parse(source)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rubocop-rspec-1.0.rc2 spec/spec_helper.rb
rubocop-rspec-1.0.rc1 spec/spec_helper.rb
rubocop-rspec-0.18.1 spec/spec_helper.rb
rubocop-rspec-0.18.0 spec/spec_helper.rb
rubocop-rspec-0.17.0 spec/spec_helper.rb