Sha256: b4d46369e79c6ea62ff28ab8f6865a36ca130aa815be9b3e1e8756b9cc6970b1

Contents?: true

Size: 670 Bytes

Versions: 9

Compression:

Stored size: 670 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)
        ContainMatcher.new(*args).spec(self)
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
remarkable-3.0.0 spec/matchers/contain_matcher.rb
remarkable-3.0.1 spec/matchers/contain_matcher.rb
remarkable-3.0.2 spec/matchers/contain_matcher.rb
remarkable-3.0.3 spec/matchers/contain_matcher.rb
remarkable-3.0.4 spec/matchers/contain_matcher.rb
remarkable-3.0.6 spec/matchers/contain_matcher.rb
remarkable-3.0.8 spec/matchers/contain_matcher.rb
remarkable-3.0.7 spec/matchers/contain_matcher.rb
remarkable-3.0.5 spec/matchers/contain_matcher.rb