Module: RSpec

Defined in:
lib/rspec-collection/all_be.rb

Overview

Allow RSpec assertions over the elements of a collection. For example:

collection.should all_be > 0

will specify that each element of the collection should be greater than zero. Each element of the collection that fails the test will be reported in the error message.

Examples:

[1,1,1].should all_be eq(1)
[2,4,6].should all_be_even
[3,6,9].should all_be_divisible_by(3)
[1,1,1].should all_be == 1
[2,3,5].should all_be { |n| prime?(n) }

(for appropriate definitions of prime? and divisible_by?)

Defined Under Namespace

Modules: Matchers