A more helpful way to view differences between complex data structures in RSpec.

The primary motivation behind this gem is to vastly improve upon RSpec's built-in diffing capabilities.Sometimes, whenever you use a matcher such as eq, match, include, or have_attributes, you will get a diff of the two data structures you are trying to match against. This is great if all you want to do is compare multi-line strings. But if you want to compare other, more "real world" kinds of values, such as what you might work with when developing API endpoints or testing methods that make database calls and return a set of model objects, then you are out of luck. Since RSpec merely runs your expected and actual values through Ruby's PrettyPrinter library and then performs a diff of these strings, the output it produces leaves much to be desired.
A more helpful way to view differences between complex data structures in RSpec. #ruby #rubydeveloper #rubyonrails #rspec. https://rubyonrails.ba/single/a-more-helpful-way-to-view-differences-between-complex-data-structures-in-rspec

Nezir Zahirovic

Contractor Ruby On Rails (8+ years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles