Sha256: 6b34a0a94a6905a3f444512a6344ee6d7d79be349e0e7d080fc1b7b810cd9e2c
Contents?: true
Size: 1.87 KB
Versions: 3
Compression:
Stored size: 1.87 KB
Contents
# encoding: utf-8 if ENV['TRAVIS'] || ENV['COVERAGE'] require 'simplecov' if ENV['TRAVIS'] require 'coveralls' SimpleCov.formatter = Coveralls::SimpleCov::Formatter end SimpleCov.start do add_filter '/spec/' add_filter '/vendor/bundle/' end end $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'rspec' require 'rubocop' require 'rubocop/cli' # disable colors in specs Sickill::Rainbow.enabled = false module ExitCodeMatchers RSpec::Matchers.define :exit_with_code do |code| actual = nil match do |block| begin block.call rescue SystemExit => e actual = e.status end actual && actual == code end failure_message_for_should do |block| "expected block to call exit(#{code}) but exit" + (actual.nil? ? ' not called' : "(#{actual}) was called") end failure_message_for_should_not do |block| "expected block not to call exit(#{code})" end description do "expect block to call exit(#{code})" end end end RSpec.configure do |config| config.filter_run_excluding ruby: ->(v) { !RUBY_VERSION.start_with?(v.to_s) } config.filter_run_excluding broken: true config.treat_symbols_as_metadata_keys_with_true_values = true config.expect_with :rspec do |c| c.syntax = :expect # disables `should` end config.include(ExitCodeMatchers) end # Requires supporting files with custom matchers and macros, etc, # in ./support/ and its subdirectories. Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f } def inspect_source(cop, source) ast, comments, tokens, _ = Rubocop::CLI.parse('(string)') do |source_buffer| source_buffer.source = source.join($RS) end cop.inspect(source, tokens, ast, comments) end class Rubocop::Cop::Cop def messages offences.map(&:message) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rubocop-0.8.3 | spec/spec_helper.rb |
rubocop-0.8.2 | spec/spec_helper.rb |
rubocop-0.8.1 | spec/spec_helper.rb |