Sha256: 23c6b3ea2d52b0fa7bc656f120c3330870451ffbe08b2ada211c8189628d2f0e
Contents?: true
Size: 926 Bytes
Versions: 1
Compression:
Stored size: 926 Bytes
Contents
# frozen_string_literal: true require "rspec/core" require "capybara_screenshot_diff/dsl" RSpec::Matchers.define :match_screenshot do |name, **options| description { "match a screenshot" } match do |_page| screenshot(name, **options) true end end RSpec.configure do |config| config.include ::CapybaraScreenshotDiff::DSL, type: :feature config.after do if self.class.include?(::CapybaraScreenshotDiff::DSL) && ::Capybara::Screenshot.active? errors = verify_screenshots!(@test_screenshots) # TODO: Use rspec/mock approach to postpone verification raise ::CapybaraScreenshotDiff::ExpectationNotMet, errors.join("\n") if errors && !errors.empty? end end config.before do if self.class.include?(::CapybaraScreenshotDiff::DSL) && ::Capybara::Screenshot.window_size ::Capybara::Screenshot::BrowserHelpers.resize_to(::Capybara::Screenshot.window_size) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
capybara-screenshot-diff-1.9.0 | lib/capybara_screenshot_diff/rspec.rb |