Sha256: e930c279a28f31776c4a4fcb75e3336dee0cb83de36ba81b198f3f0e95729d06

Contents?: true

Size: 650 Bytes

Versions: 40

Compression:

Stored size: 650 Bytes

Contents

module RSpec
  module Mocks
    module ArgumentMatchers
      class ArrayIncludingMatcher
        def initialize(expected)
          @expected = expected
        end

        def ==(actual)
          @expected.all? do |value|
            if Regexp === value
              actual.any? {|v| value =~ v }
            else
              actual.include?(value)
            end
          end
        rescue NoMethodError
          false
        end

        def description
          "array_including(#{@expected.inspect})"
        end
      end

      def array_including(*args)
        ArrayIncludingMatcher.new(args.flatten)
      end
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
honeybadger-1.16.7 spec/support/array_including.rb
honeybadger-1.16.6 spec/support/array_including.rb
honeybadger-1.16.5 spec/support/array_including.rb
honeybadger-1.16.4 spec/support/array_including.rb
honeybadger-1.16.3 spec/support/array_including.rb
honeybadger-1.16.2 spec/support/array_including.rb
honeybadger-1.16.1 spec/support/array_including.rb
honeybadger-1.16.0 spec/support/array_including.rb
honeybadger-1.15.3 spec/support/array_including.rb
honeybadger-1.15.2 spec/support/array_including.rb
honeybadger-1.15.1 spec/support/array_including.rb
honeybadger-1.15.0 spec/support/array_including.rb
honeybadger-1.14.0 spec/support/array_including.rb
honeybadger-1.13.2 spec/support/array_including.rb
honeybadger-1.13.1 spec/support/array_including.rb
honeybadger-1.13.0 spec/support/array_including.rb
honeybadger-1.12.0.beta3 spec/support/array_including.rb
honeybadger-1.12.0.beta2 spec/support/array_including.rb
honeybadger-1.11.2 spec/support/array_including.rb
honeybadger-1.11.1 spec/support/array_including.rb