spec/spec_helper.rb in dry-system-rails-0.1.0 vs spec/spec_helper.rb in dry-system-rails-0.2.0

- old
+ new

@@ -1,5 +1,20 @@ +# frozen_string_literal: true + +if RUBY_ENGINE == 'ruby' && ENV['COVERAGE'] == 'true' + require 'yaml' + rubies = YAML.safe_load(File.read(File.join(__dir__, '..', '.travis.yml')))['rvm'] + latest_mri = rubies.select { |v| v =~ /\A\d+\.\d+.\d+\z/ }.max + + if RUBY_VERSION == latest_mri + require 'simplecov' + SimpleCov.start do + add_filter '/spec/' + end + end +end + begin require 'byebug' rescue LoadError; end require 'dry-system-rails' @@ -7,11 +22,9 @@ SPEC_ROOT = Pathname(__dir__) Dir[SPEC_ROOT.join('shared/**/*.rb')].each(&method(:require)) Dir[SPEC_ROOT.join('support/**/*.rb')].each(&method(:require)) -ENV['RAILS_ENV'] = 'test' +ENV['RAILS_ENV'] ||= 'test' require SPEC_ROOT.join('dummy/config/environment') -RSpec.configure do |config| - config.disable_monkey_patching! -end +RSpec.configure(&:disable_monkey_patching!)