lib/capybara/screenshot/diff/drivers/utils.rb in capybara-screenshot-diff-1.7.1 vs lib/capybara/screenshot/diff/drivers/utils.rb in capybara-screenshot-diff-1.8.0
- old
+ new
@@ -17,9 +17,25 @@
# chunky_png not present
end
result
end
+ def self.find_driver_class_for(driver)
+ driver = AVAILABLE_DRIVERS.first if driver == :auto
+
+ LOADED_DRIVERS[driver] ||=
+ case driver
+ when :chunky_png
+ require "capybara/screenshot/diff/drivers/chunky_png_driver"
+ Drivers::ChunkyPNGDriver
+ when :vips
+ require "capybara/screenshot/diff/drivers/vips_driver"
+ Drivers::VipsDriver
+ else
+ fail "Wrong adapter #{driver.inspect}. Available adapters: #{AVAILABLE_DRIVERS.inspect}"
+ end
+ end
+
def self.detect_test_framework_assert
require "minitest"
::Minitest::Assertion
rescue
::RuntimeError