Commit 6e960119 authored by Oleksandr Slynko's avatar Oleksandr Slynko Committed by Houssem El Fekih

Use conditional search instead of rescuing from exception

parent 1dc1a348
module RSpec
version = Gem.loaded_specs["rspec-core"].version
require "rspec/instafail/rspec_#{[3, version.segments.first].min}"
rescue
require "rspec/instafail/rspec_1"
gem_spec = Gem::Specification.find_all_by_name('rspec-core').first
if gem_spec
version = gem_spec.version
require "rspec/instafail/rspec_#{[3, version.segments.first].min}"
else
require "rspec/instafail/rspec_1"
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment