Sha256: 50f59edde1650db85908f873bedaefd5a557312ee02f1e0b8440193ffe9159f2

Contents?: true

Size: 463 Bytes

Versions: 15

Compression:

Stored size: 463 Bytes

Contents

RSpec::Matchers.define :include_where do |condition|
  match do |array|
    raise "You can use :include_where with an array response" unless array.is_a?(Array)
    array.any? { |item| condition.call(item) }
  end

  failure_message do |array|
    "expected array to include something according to the block #{condition}"
  end

  failure_message_when_negated do |actual|
    "expected array to not include something according to the block #{condition}"
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
restspec-0.3.2 lib/restspec/rspec/matchers/include_where.rb
restspec-0.3.1 lib/restspec/rspec/matchers/include_where.rb
restspec-0.3.0 lib/restspec/rspec/matchers/include_where.rb
restspec-0.2.6 lib/restspec/rspec/matchers/include_where.rb
restspec-0.2.5 lib/restspec/rspec/matchers/include_where.rb
restspec-0.2.4 lib/restspec/rspec/matchers/include_where.rb
restspec-0.2.3 lib/restspec/rspec/matchers/include_where.rb
restspec-0.2.2 lib/restspec/rspec/matchers/include_where.rb
restspec-0.2.1 lib/restspec/rspec/matchers/include_where.rb
restspec-0.2 lib/restspec/rspec/matchers/include_where.rb
restspec-0.1 lib/restspec/rspec/matchers/include_where.rb
restspec-0.0.4 lib/restspec/rspec/matchers/include_where.rb
restspec-0.0.3 lib/restspec/rspec/matchers/include_where.rb
restspec-0.0.2 lib/restspec/rspec/matchers/include_where.rb
restspec-0.0.1 lib/restspec/rspec/matchers/include_where.rb