Module: TestProf::Utils
- Defined in:
- lib/test_prof/utils.rb,
lib/test_prof/utils/rspec.rb,
lib/test_prof/utils/html_builder.rb,
lib/test_prof/utils/sized_ordered_set.rb
Overview
:nodoc:
Defined Under Namespace
Modules: HTMLBuilder, RSpec Classes: SizedOrderedSet
Class Method Summary collapse
- .supported_version?(gem_version, at_least, at_most) ⇒ Boolean
-
.verify_gem_version(gem_name, at_least: nil, at_most: nil) ⇒ Object
Verify that loaded gem has correct version.
Class Method Details
.supported_version?(gem_version, at_least, at_most) ⇒ Boolean
18 19 20 21 |
# File 'lib/test_prof/utils.rb', line 18 def supported_version?(gem_version, at_least, at_most) (at_least.nil? || Gem::Version.new(at_least) <= gem_version) && (at_most.nil? || Gem::Version.new(at_most) >= gem_version) end |
.verify_gem_version(gem_name, at_least: nil, at_most: nil) ⇒ Object
Verify that loaded gem has correct version
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/test_prof/utils.rb', line 7 def verify_gem_version(gem_name, at_least: nil, at_most: nil) raise ArgumentError, "Please, provide `at_least` or `at_most` argument" if at_least.nil? && at_most.nil? spec = Gem.loaded_specs[gem_name] version = spec.version if spec return false if version.nil? supported_version?(version, at_least, at_most) end |