File: spec_helper.rb

package info (click to toggle)
ruby-addressable 2.8.9-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,016 kB
  • sloc: ruby: 13,688; makefile: 11
file content (41 lines) | stat: -rw-r--r-- 752 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# frozen_string_literal: true

require 'rspec/its'

begin
  require 'coveralls'
  Coveralls.wear! do
    add_filter "spec/"
    add_filter "vendor/"
  end
rescue LoadError
  warn "warning: coveralls gem not found; skipping Coveralls"
  require 'simplecov'
  SimpleCov.start do
    add_filter "spec/"
    add_filter "vendor/"
  end
end if Gem.loaded_specs.key?("simplecov")

class TestHelper
  def self.is_jruby?
    Object.const_defined? :JRUBY_VERSION
  end

  def self.is_mri?
    RUBY_ENGINE == "ruby"
  end

  def self.is_windows?
    RUBY_DESCRIPTION =~ /mswin|ming|cygwin/
  end

  def self.native_supported?
    is_mri? && !is_windows?
  end
end

RSpec.configure do |config|
  config.warnings = true
  config.filter_run_when_matching :focus
end