Class: PdfMatcher::Testing::Matcher::MatchPdf

Inherits:
Object
  • Object
show all
Includes:
RSpec::Matchers::Composable
Defined in:
lib/pdf_matcher/testing/matcher.rb

Instance Method Summary collapse

Constructor Details

#initialize(expected_pdf, output_diff) ⇒ MatchPdf

Returns a new instance of MatchPdf.



16
17
18
19
# File 'lib/pdf_matcher/testing/matcher.rb', line 16

def initialize(expected_pdf, output_diff)
  @expected_pdf = expected_pdf
  @output_diff = output_diff
end

Instance Method Details

#descriptionObject



29
30
31
# File 'lib/pdf_matcher/testing/matcher.rb', line 29

def description
  'match the expected pdf'
end

#failure_messageObject



25
26
27
# File 'lib/pdf_matcher/testing/matcher.rb', line 25

def failure_message
  FailureMessage.build(@output_diff)
end

#matches?(actual_pdf) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/pdf_matcher/testing/matcher.rb', line 21

def matches?(actual_pdf)
  PdfMatcher.match?(@expected_pdf, actual_pdf, output_diff: @output_diff)
end