Sha256: deaf31921d679ffa357f6eef06d6b1df255b4b2e769fd0bd309ffcb22db65ddb

Contents?: true

Size: 659 Bytes

Versions: 1

Compression:

Stored size: 659 Bytes

Contents

module Remarkable
  module Specs
    module Matchers
      class ContainMatcher < Remarkable::Base
        def initialize(*values)
          @values = values
        end

        def matches?(subject)
          @subject = subject

          assert_collection(nil, @values) do |value|
            @value = value
            included?
          end
        end

        def included?
          return true if @subject.include?(@value)

          @expectation = "#{@value} is included in #{@subject.inspect}"
          false
        end
      end

      def contain(*args, &block)
        ContainMatcher.new(*args, &block).spec(self)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
remarkable-3.1.9 spec/matchers/contain_matcher.rb