RSpec Custom Expectation Matchers Explained

Опубликовано: 10 Октябрь 2024
на канале: Brett Codes
219
12

When working with RSpec, you can define custom matchers to make your tests more expressive and DRY up your code. In this screencast, I walk through defining `expect(hash).to have_key_with_value(key, value)` to show how to use this advanced RSpec functionality.

Source code: https://github.com/brettchalupa/scree...

Ruby 3.1.1
RSpec 3.10.0

RSpec docs on defining custom matchers: https://relishapp.com/rspec/rspec-exp...