Sha256: c9b52abd65fb5a3cf51d00af26722624a174472065b2c77cedea5cd3174fdae9

Contents?: true

Size: 686 Bytes

Versions: 10

Compression:

Stored size: 686 Bytes

Contents

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

        def matches?(subject)
          @subject = subject

          assert_matcher_for(@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

10 entries across 10 versions & 1 rubygems

Version Path
remarkable-3.1.7 spec/matchers/contain_matcher.rb
remarkable-3.0.10 spec/matchers/contain_matcher.rb
remarkable-3.0.9 spec/matchers/contain_matcher.rb
remarkable-3.1.3 spec/matchers/contain_matcher.rb
remarkable-3.1.4 spec/matchers/contain_matcher.rb
remarkable-3.1.0 spec/matchers/contain_matcher.rb
remarkable-3.1.5 spec/matchers/contain_matcher.rb
remarkable-3.1.6 spec/matchers/contain_matcher.rb
remarkable-3.1.1 spec/matchers/contain_matcher.rb
remarkable-3.1.2 spec/matchers/contain_matcher.rb