{"id":15284327,"url":"https://github.com/monade/rspec_match_structure","last_synced_at":"2025-11-11T18:27:21.821Z","repository":{"id":57679811,"uuid":"472840635","full_name":"monade/rspec_match_structure","owner":"monade","description":"A smart structure matcher for RSpec. Raise your expectations!","archived":false,"fork":false,"pushed_at":"2022-08-01T10:29:26.000Z","size":36,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-06-23T17:51:10.413Z","etag":null,"topics":["rails","rspec","rspec-matchers","ruby"],"latest_commit_sha":null,"homepage":"https://monade.io/en/home-en/","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/monade.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-03-22T16:17:27.000Z","updated_at":"2022-08-05T10:07:32.000Z","dependencies_parsed_at":"2022-08-28T08:21:05.371Z","dependency_job_id":null,"html_url":"https://github.com/monade/rspec_match_structure","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/monade/rspec_match_structure","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monade%2Frspec_match_structure","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monade%2Frspec_match_structure/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monade%2Frspec_match_structure/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monade%2Frspec_match_structure/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/monade","download_url":"https://codeload.github.com/monade/rspec_match_structure/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monade%2Frspec_match_structure/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266437377,"owners_count":23928237,"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","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["rails","rspec","rspec-matchers","ruby"],"created_at":"2024-09-30T14:53:35.610Z","updated_at":"2025-11-11T18:27:21.732Z","avatar_url":"https://github.com/monade.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RSpec match_structure\n\n[![Tests](https://github.com/monade/rspec_match_structure/actions/workflows/test.yml/badge.svg)](https://github.com/monade/rspec_match_structure/actions/workflows/test.yml)\n[![Ruby Gem](https://github.com/monade/rspec_match_structure/actions/workflows/gem-push.yml/badge.svg)](https://github.com/monade/rspec_match_structure/actions/workflows/gem-push.yml)\n\nRaise your expectations! RSpec match_structure is a gem that allows to test the structure of your string, hashes and lists.\n\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'rspec_match_structure'\n```\n\nAnd then execute:\n\n    $ bundle install\n\nOr install it yourself as:\n\n    $ gem install rspec_match_structure\n\n## Usage\n\n`match_strucure` can match various types of data and structures against schemas. A dead simple example of what it can do is:\n\n```ruby\nexpect([\"a\", \"b\", \"c\"]).to match_structure(a_list_of(String).with(2).elements_at_least)\n```\n\nAnother example:\n\n```ruby\nexpect([\n         {\n           id: '1',\n           type: 'users'\n         },\n         {\n           id: '2',\n           type: 'users'\n         },\n         {\n           id: '1',\n           type: 'posts'\n         }\n       ]).to match_structure(a_list_with({ type: 'users' }).exactly(2).times)\n```\n\nIt can also match string agains regular expressions:\n\n```ruby\n expect(\"abc\").to match_structure( /abc/ )\n```\n\nThis is especially useful when you want to test a JSON:API response:\n\n```ruby\n\n    expect(response.body).to match_structure(\n                               {\n                                 data: {\n                                     id: String,\n                                     type: 'someType',\n                                     attributes: {\n                                       anAttribute: String\n                                     }\n                                },\n                                 included: [\n                                   a_list_with({ type: 'relatedType' }).exactly(1).times\n                                 ]\n                               }\n                             )\n```\n\nTo see all the various features please refer to the [spec file](https://github.com/monade/rspec_match_structure/blob/master/spec/rspec_match_structure_spec.rb).\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/monade/rspec_match_structure.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\nAbout Monade\n----------------\n\n![monade](https://monade.io/wp-content/uploads/2021/06/monadelogo.png)\n\nrspec_match_structure is maintained by [mònade srl](https://monade.io/en/home-en/).\n\nWe \u003c3 open source software. [Contact us](https://monade.io/en/contact-us/) for your next project!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonade%2Frspec_match_structure","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmonade%2Frspec_match_structure","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonade%2Frspec_match_structure/lists"}