#assertpattern — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #assertpattern, aggregated by home.social.
-
If you haven't written Ruby tests using Minitest in a while, you might have missed the addition of the assert_pattern assertion (available in Ruby 3.0 and higher). It's my absolute favorite assertion when I need to validate a complex object-like an array or a hash-in a single go.
There is one limitation when checking hashes: keys can only be symbols. So if you want to validate JSON, you'll need to transform its keys from strings to symbols.