Skip to content

Instantly share code, notes, and snippets.

@giljr
Created October 30, 2025 20:29
Show Gist options
  • Save giljr/0164316759c40ce6784af6306b7a546b to your computer and use it in GitHub Desktop.
Save giljr/0164316759c40ce6784af6306b7a546b to your computer and use it in GitHub Desktop.
What are chained methods in RSpec?
Concept Meaning
Chained method A sub-method added to a custom matcher with chain
Purpose Extend matcher behavior with extra options or context
Example expect(user).to have_error_message("can't be blank").on_field(:name)
Config effect include_chain_clauses_in_custom_matcher_descriptions = true makes RSpec include .on_field(:name) in failure messages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment