Rspec Expectations

screenshot of Rspec Expectations

Rspec Expectations

Provides a readable API to express expected outcomes of a code example

Overview:

RSpec Expectations is a testing framework that allows users to express expected outcomes on an object in an example. It is commonly used with tools like RSpec, Test::Unit, Minitest, or Cucumber for testing Ruby applications.

Features:

  • Built-in matchers: Equivalence, Identity comparisons, Regular expressions, Truthiness, Expecting errors, Expecting throws, Yielding, etc.
  • Compound Matcher Expressions: Create compound matcher expressions using and or or.
  • Composing Matchers: Many built-in matchers take matchers as arguments for flexible specifications.