RSpec matcher "be_sorted"

RSpec::Matchers.define :be_naturally_sorted do
  match do |array|
    array == array.natural_sort
  end
end

See RSpec: Where to put custom matchers and other support code. To use natural_sort, see this card.


This matcher is now part of Spreewald Show archive.org snapshot .

Dominik Schöler Over 9 years ago