{"id":13879421,"url":"https://github.com/splitwise/super_diff","last_synced_at":"2026-04-05T17:37:35.318Z","repository":{"id":1321183,"uuid":"1266194","full_name":"splitwise/super_diff","owner":"splitwise","description":"A more helpful way to view differences between complex data structures in RSpec.","archived":false,"fork":false,"pushed_at":"2025-04-30T16:30:59.000Z","size":5707,"stargazers_count":1012,"open_issues_count":48,"forks_count":57,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-05-04T22:02:05.900Z","etag":null,"topics":["rspec","ruby","testing"],"latest_commit_sha":null,"homepage":"https://splitwise.github.io/super_diff/","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/splitwise.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":"support/current_bundle.rb","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["mcmire"],"issuehunt":["mcmire"]}},"created_at":"2011-01-18T06:25:07.000Z","updated_at":"2025-05-01T15:27:58.000Z","dependencies_parsed_at":"2023-01-16T18:30:24.414Z","dependency_job_id":"eff1d5af-1a09-4a14-a163-e497911b0b13","html_url":"https://github.com/splitwise/super_diff","commit_stats":{"total_commits":321,"total_committers":25,"mean_commits":12.84,"dds":0.2180685358255452,"last_synced_commit":"613bc301dc7d882c03ac87ba80084b7425f49c12"},"previous_names":["splitwise/super_diff"],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/splitwise%2Fsuper_diff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/splitwise%2Fsuper_diff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/splitwise%2Fsuper_diff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/splitwise%2Fsuper_diff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/splitwise","download_url":"https://codeload.github.com/splitwise/super_diff/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254000885,"owners_count":21997443,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rspec","ruby","testing"],"created_at":"2024-08-06T08:02:20.562Z","updated_at":"2026-04-05T17:37:35.310Z","avatar_url":"https://github.com/splitwise.png","language":"Ruby","readme":"# SuperDiff [![Gem Version][version-badge]][rubygems] [![Build Status][gh-actions-badge]][gh-actions] ![Downloads][downloads-badge]\n\n[version-badge]: http://img.shields.io/gem/v/super_diff.svg\n[rubygems]: http://rubygems.org/gems/super_diff\n[gh-actions-badge]: https://img.shields.io/github/actions/workflow/status/splitwise/super_diff/super_diff.yml?branch=main\n[downloads-badge]: http://img.shields.io/gem/dtv/super_diff.svg\n[hound]: https://houndci.com\n\n**SuperDiff** is a Ruby gem\nwhich is designed to display the differences between two objects of any type\nin a familiar and intelligent fashion.\n\n📢 **[See what's changed in recent versions.][changelog]**\n\n[changelog]: ./CHANGELOG.md\n\n## Introduction\n\nThe primary motivation behind this gem\nis to vastly improve upon RSpec's built-in diffing capabilities.\nRSpec has many nice features,\nand one of them is that whenever you use a matcher such as `eq`, `match`, `include`, or `have_attributes`,\nyou will get a diff of the two data structures you are trying to match against.\nThis is great if all you want to do is compare multi-line strings.\nBut if you want to compare other, more \"real world\" kinds of values such as API or database data,\nthen you are out of luck.\nSince [RSpec merely runs your `expected` and `actual` values through Ruby's PrettyPrinter library][rspec-differ-fail]\nand then performs a diff of these strings,\nthe output it produces leaves much to be desired.\n\n[rspec-differ-fail]: https://github.com/rspec/rspec/blob/rspec-support-v3.13.2/rspec-support/lib/rspec/support/differ.rb#L180-L192\n\nFor instance, let's say you wanted to compare these two hashes:\n\n```ruby\nactual = {\n  customer: {\n    person: SuperDiff::Test::Person.new(name: \"Marty McFly, Jr.\", age: 17),\n    shipping_address: {\n      line_1: \"456 Ponderosa Ct.\",\n      city: \"Hill Valley\",\n      state: \"CA\",\n      zip: \"90382\"\n    }\n  },\n  items: [\n    { name: \"Fender Stratocaster\", cost: 100_000, options: %w[red blue green] },\n    { name: \"Mattel Hoverboard\" }\n  ]\n}\n\nexpected = {\n  customer: {\n    person: SuperDiff::Test::Person.new(name: \"Marty McFly\", age: 17),\n    shipping_address: {\n      line_1: \"123 Main St.\",\n      city: \"Hill Valley\",\n      state: \"CA\",\n      zip: \"90382\"\n    }\n  },\n  items: [\n    { name: \"Fender Stratocaster\", cost: 100_000, options: %w[red blue green] },\n    { name: \"Chevy 4x4\" }\n  ]\n}\n```\n\nIf, somewhere in a test, you were to say:\n\n```ruby\nexpect(actual).to eq(expected)\n```\n\nYou would get output that looks like this:\n\n![Before super_diff](docs/assets/before.png)\n\nWhat this library does\nis to provide a diff engine\nthat knows how to figure out the differences between any two data structures\nand display them in a sensible way.\nSo, using the example above,\nyou'd get this instead:\n\n![After super_diff](docs/assets/after.png)\n\n## Installation \u0026 Usage\n\n📘 For more on how to install and use SuperDiff,\n[read the user documentation][user-docs].\n\n[user-docs]: ./docs/users/getting-started.md\n\n## Support\n\nMy goal for this library is to improve your development experience.\nIf this is not the case,\nand you encounter a bug or have a suggestion,\nfeel free to [create an issue][issues-list].\nI'll try to respond to it as soon as I can!\n\n[issues-list]: https://github.com/splitwise/super_diff/issues\n\n## Contributing\n\nAny code contributions to improve this library are welcome!\nPlease see the [contributing](./docs/contributors/index.md) document\nfor more on how to do that.\n\n## Compatibility\n\n`super_diff` is [tested][gh-actions] to work with\nRuby \u003e= 3.1,\nRSpec 3.x,\nand Rails \u003e= 7.0.\n\n[gh-actions]: https://github.com/splitwise/super_diff/actions?query=workflow%3ASuperDiff\n\n## Inspiration/Thanks\n\nIn developing this gem\nI made use of or was heavily inspired by these libraries:\n\n- [Diff::LCS][diff-lcs],\n  the library I started with in the [original version of this gem][original-version]\n  (made in 2011!)\n- The pretty-printing algorithms and API within [PrettyPrinter][pretty-printer] and [AwesomePrint][awesome-print],\n  from which I borrowed ideas to develop the [inspectors][inspection-tree].\n\nThank you to the authors of these libraries!\n\n[original-version]: https://github.com/splitwise/super_diff/tree/old-master\n[diff-lcs]: https://github.com/halostatue/diff-lcs\n[pretty-printer]: https://github.com/ruby/ruby/tree/master/lib/prettyprint.rb\n[awesome-print]: https://github.com/awesome-print/awesome_print\n[inspection-tree]: https://github.com/splitwise/super_diff/blob/main/lib/super_diff/core/inspection_tree.rb\n\n## Author/License\n\nSuperDiff was created by Elliot Winkler and is maintained by Splitwise, Inc.\nIt is released under the [MIT license](LICENSE).\n","funding_links":["https://github.com/sponsors/mcmire","https://issuehunt.io/r/[\"mcmire\"]"],"categories":["Ruby"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsplitwise%2Fsuper_diff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsplitwise%2Fsuper_diff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsplitwise%2Fsuper_diff/lists"}