{"id":14991363,"url":"https://github.com/monade/rspec_sql_matcher","last_synced_at":"2026-02-18T01:05:51.973Z","repository":{"id":59635951,"uuid":"510795664","full_name":"monade/rspec_sql_matcher","owner":"monade","description":"A gem to match SQL queries within your RSpec tests","archived":false,"fork":false,"pushed_at":"2025-03-19T09:41:23.000Z","size":23,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-10-29T21:36:29.513Z","etag":null,"topics":["rails","rspec","rspec-matchers","ruby","sql"],"latest_commit_sha":null,"homepage":"https://monade.io","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-07-05T15:34:34.000Z","updated_at":"2025-03-19T09:41:27.000Z","dependencies_parsed_at":"2022-09-19T10:41:17.913Z","dependency_job_id":null,"html_url":"https://github.com/monade/rspec_sql_matcher","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/monade/rspec_sql_matcher","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monade%2Frspec_sql_matcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monade%2Frspec_sql_matcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monade%2Frspec_sql_matcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monade%2Frspec_sql_matcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/monade","download_url":"https://codeload.github.com/monade/rspec_sql_matcher/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monade%2Frspec_sql_matcher/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29565018,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-18T00:47:08.760Z","status":"ssl_error","status_checked_at":"2026-02-18T00:45:26.718Z","response_time":100,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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","sql"],"created_at":"2024-09-24T14:27:32.877Z","updated_at":"2026-02-18T01:05:51.951Z","avatar_url":"https://github.com/monade.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RSpec SQL Matcher\n\n![Tests](https://github.com/monade/rspec_sql_matcher/actions/workflows/test.yml/badge.svg)\n[![Gem Version](https://badge.fury.io/rb/rspec_sql_matcher.svg)](https://badge.fury.io/rb/rspec_sql_matcher)\n\nA gem to match SQL queries within your RSpec tests\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'rspec_sql_matcher'\n```\n\nAnd then execute:\n\n    $ bundle install\n\nOr install it yourself as:\n\n    $ gem install rspec_sql_matcher\n\n## Usage\n\nThis gem defines a couple of matchers that can help to capture queries and check if they are correctly formatted.\n\nMoreover, with the `RSpec::SqlMatcher::Helpers` module, it defines a set of helper methods to capture data from queries executed inside theirs blocks.\n\n### have_run_queries\n`have_run_queries` can match if a query has been run inside a block. For instance:\n\n```ruby\nexpect { YourJob.perform_now }.to have_run_queries\n```\n\nIt accepts various options:\n\n```ruby\nexpect { YourJob.perform_now }.to have_run_queries(exactly: 2)\nexpect { YourJob.perform_now }.to have_run_queries(min: 2, max: 5)\n```\n\n### match_query\n`match_query` can match query content using regular expressions. For instance:\n\n```ruby\nexpect { User.very_complex_scope }.to match_query(/ GROUP BY \"users\".\"id\"/)\n```\n\nTo see all the various features please refer to the [spec file](https://github.com/monade/rspec_sql_matcher/blob/main/rspec_sql_matcher).\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_sql_matcher.\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/2023/02/logo-monade.svg)\n\nactive_queryable is maintained by [mònade srl](https://monade.io).\n\nWe \u003c3 open source software. [Contact us](https://monade.io) for your next project!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonade%2Frspec_sql_matcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmonade%2Frspec_sql_matcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonade%2Frspec_sql_matcher/lists"}