module RSpec::ChangeToNow::Matchers::DSL::Detect

Public Instance Methods

detect(*expected, &block) click to toggle source

@api public If given a block, passes if the block returns a truthy value for any of the actual items or for the key-value pair is the actual item list is a hash. Without a block, it behaves identically to include. expected must be empty if a block is provided.

@example

expect([2]).to detect(&:even?)
expect({a: 2}).to detect { |k,v| v.even? }
expect([1]).to detect 1
# File lib/rspec/change_to_now/matchers/dsl.rb, line 30
def detect(*expected, &block)
  RSpec::ChangeToNow::Matchers::Detect.new(*expected, &block)
end