File: matcher.rb

package info (click to toggle)
ruby-eim-xml 1.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 236 kB
  • sloc: ruby: 2,015; makefile: 5
file content (28 lines) | stat: -rw-r--r-- 549 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
require 'eim_xml'

module EimXML
  module Matchers
    class HaveContent
      def initialize(expected)
        @expected = expected
      end

      def matches?(target)
        @target = target
        @target.has?(@expected)
      end

      def failure_message
        "expected #{@target.inspect} must have #{@expected}, but not."
      end

      def negative_failure_message
        "expected #{@target.inspect} must not have #{@expected}, but has."
      end
    end

    def have(expected)
      HaveContent.new(expected)
    end
  end
end