lib/appium_lib/driver.rb in appium_lib-9.8.4 vs lib/appium_lib/driver.rb in appium_lib-9.8.5

- old
+ new

@@ -1,30 +1,35 @@ -# Fix uninitialized constant Minitest (NameError) -module Minitest - # Fix superclass mismatch for class Spec - class Runnable - end +# Load only Minitest is loaded +if defined?(Minitest::VERSION) + # Fix uninitialized constant Minitest (NameError) + module Minitest + # Fix superclass mismatch for class Spec + class Runnable + end - # To switch load class - def self.left_greater_than_or_equal_to_right?(left, right) - left.split('.').zip(right.split('.')).each do |value| - diff = value[0].to_i - value[1].to_i - return true if diff > 0 - return false if diff < 0 + # defined? 'Minitest' # expression + + # To switch load class + def self.left_greater_than_or_equal_to_right?(left, right) + left.split('.').zip(right.split('.')).each do |value| + diff = value[0].to_i - value[1].to_i + return true if diff > 0 + return false if diff < 0 + end + true end - true - end - if left_greater_than_or_equal_to_right?(VERSION, '5.11.0') - # http://docs.seattlerb.org/minitest/History_rdoc.html#label-5.11.0+-2F+2018-01-01 - # `Minitest::Test` became a subclass of `Minitest::Result` - class Test < Result + if left_greater_than_or_equal_to_right?(VERSION, '5.11.0') + # http://docs.seattlerb.org/minitest/History_rdoc.html#label-5.11.0+-2F+2018-01-01 + # `Minitest::Test` became a subclass of `Minitest::Result` + class Test < Result + end + else + class Test < Runnable + end end - else - class Test < Runnable + class Spec < Test end - end - class Spec < Test end end require 'appium_lib_core'