summaryrefslogtreecommitdiff
path: root/spec/spec_helper/matchers/annotate.rb
blob: a0877ab3f8f60b3a1352da611ef5f18a621127cc (plain) (blame)
1
2
3
4
5
6
7
8
9
# frozen_string_literal: true

RSpec::Matchers.define :annotate do |text|
  match do |subject|
    left, bottom, right, top = subject[:Rect]
    left == text[:x] && ((text[:x] + text[:width]) - right).abs < 0.25 && bottom < text[:y] && top > (text[:y] + text[:font_size])
  end
  failure_message {|subject| %(expected #{subject} to annotate #{text}) }
end