Sha256: 227f7c37891e87e57253dffab2031ceddc77c07b135ceab1fff3ffcd5e1c0310

Contents?: true

Size: 757 Bytes

Versions: 4

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

4 entries across 4 versions & 1 rubygems

Version Path
rubocop-rspec-1.1.0 spec/spec_helper.rb
rubocop-rspec-1.0.1 spec/spec_helper.rb
rubocop-rspec-1.0 spec/spec_helper.rb
rubocop-rspec-1.0.rc3 spec/spec_helper.rb