{"id":14991226,"url":"https://github.com/rspec/rspec-collection_matchers","last_synced_at":"2025-10-19T06:53:36.654Z","repository":{"id":37663761,"uuid":"11573140","full_name":"rspec/rspec-collection_matchers","owner":"rspec","description":"Collection cardinality matchers, extracted from rspec-expectations","archived":false,"fork":false,"pushed_at":"2025-02-15T23:39:25.000Z","size":109,"stargazers_count":194,"open_issues_count":0,"forks_count":25,"subscribers_count":13,"default_branch":"main","last_synced_at":"2025-10-11T01:31:44.311Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/rspec.png","metadata":{"files":{"readme":"README.md","changelog":"Changelog.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["JonRowe"],"open_collective":"rspec"}},"created_at":"2013-07-22T04:51:15.000Z","updated_at":"2025-06-27T10:02:12.000Z","dependencies_parsed_at":"2024-06-18T12:42:45.861Z","dependency_job_id":"bcc20e47-155d-4ea9-8151-315ae3ed6488","html_url":"https://github.com/rspec/rspec-collection_matchers","commit_stats":{"total_commits":118,"total_committers":16,"mean_commits":7.375,"dds":0.6271186440677966,"last_synced_commit":"2c6ef8179d5c78092fbf7484c90c300399d2150d"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/rspec/rspec-collection_matchers","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rspec%2Frspec-collection_matchers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rspec%2Frspec-collection_matchers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rspec%2Frspec-collection_matchers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rspec%2Frspec-collection_matchers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rspec","download_url":"https://codeload.github.com/rspec/rspec-collection_matchers/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rspec%2Frspec-collection_matchers/sbom","scorecard":{"id":787565,"data":{"date":"2025-08-11","repo":{"name":"github.com/rspec/rspec-collection_matchers","commit":"5a4b4bad279aeae7358281417fa7f9aaeee830a2"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.7,"checks":[{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":10,"reason":"GitHub workflow tokens follow principle of least privilege","details":["Info: topLevel 'contents' permission set to 'read': .github/workflows/ci.yml:13","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":3,"reason":"Found 5/16 approved changesets -- score normalized to 3","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:35: update your workflow using https://app.stepsecurity.io/secureworkflow/rspec/rspec-collection_matchers/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:36: update your workflow using https://app.stepsecurity.io/secureworkflow/rspec/rspec-collection_matchers/ci.yml/main?enable=pin","Info:   0 out of   1 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Info: FSF or OSI recognized license: MIT License: LICENSE.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 24 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-23T06:29:23.595Z","repository_id":37663761,"created_at":"2025-08-23T06:29:23.595Z","updated_at":"2025-08-23T06:29:23.595Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279448768,"owners_count":26172019,"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-10-17T02:00:07.504Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":[],"created_at":"2024-09-24T14:21:54.763Z","updated_at":"2025-10-19T06:53:36.603Z","avatar_url":"https://github.com/rspec.png","language":"Ruby","funding_links":["https://github.com/sponsors/JonRowe","https://opencollective.com/rspec"],"categories":[],"sub_categories":[],"readme":"# RSpec::CollectionMatchers [![Build Status](https://secure.travis-ci.org/rspec/rspec-collection_matchers.svg?branch=main)](http://travis-ci.org/rspec/rspec-collection_matchers)\n\nRSpec::CollectionMatchers lets you express expected outcomes on collections\nof an object in an example.\n\n```ruby\nexpect(account.shopping_cart).to have_exactly(3).items\n```\n\n## Install\n\nAdd this line to your application's Gemfile:\n\n    gem 'rspec-collection_matchers'\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install rspec-collection_matchers\n\n## Basic usage\n\nFirst of all, you need to require rspec-collection matchers. Add the following line to your `spec_helper.rb`:\n\n```ruby\nrequire 'rspec/collection_matchers'\n```\n\nUsing `rspec-collection_matchers` you can match the number of items in a\ncollection directly, e.g.:\n\n```ruby\nit 'matches number of items in a collection' do\n  expect([1,2,3]).to have_at_least(3).items\nend\n```\n\nYou can also match the number of items returned by a method on an object, e.g.:\n\n```ruby\nclass Cart\n  def initialize(*products)\n    @products = products\n  end\n  attr_reader :products\nend\n\nit 'matches number of items returned from a method' do\n  cart = Cart.new('product a', 'product b')\n  expect(cart).to have_at_most(2).products\nend\n```\n\nThe last line of the example expresses an expected outcome:\nif `cart.products.size \u003c= 2` then the example passes, otherwise it fails with a message like:\n\n    expected at most 2 products, got 3\n\n## Available matchers\n\n```ruby\nexpect(collection).to have(n).items\nexpect(collection).to have_exactly(n).items\nexpect(collection).to have_at_most(n).items\nexpect(collection).to have_at_least(n).items\nexpect(collection).to have(:no).items\n```\n\n## See also\n\n* [http://github.com/rspec/rspec](http://github.com/rspec/rspec)\n* [http://github.com/rspec/rspec-core](http://github.com/rspec/rspec-core)\n* [http://github.com/rspec/rspec-expectations](http://github.com/rspec/rspec-expectations)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frspec%2Frspec-collection_matchers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frspec%2Frspec-collection_matchers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frspec%2Frspec-collection_matchers/lists"}