Skip to content

[TOOLING] Add fluent API to be_sorted matcher [RUN AS-IF-FOSS]

Alex Kalderimis requested to merge ajk-be-sorted into master

What does this MR do?

This improves the be_sorted matcher by adding three fluent methods:

  • be_sorted.asc: equivalent to be_sorted(:identity, :asc)
  • be_sorted.desc: equivalent to be_sorted(:identity, :desc)
  • be_sorted.by(&projection): equivalent to be_sorted(projection)

The rationale for this is:

it is much easier to see what the arguments mean, rather than using positional arguments, and it is much easier to pass complex projection logic rather than having to package it up as procs.

As a developer facing tooling change, this does not need a Changelog.

Tests are added for this matcher.

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Edited by Alex Kalderimis

Merge request reports

Loading