https://github.com/rspec/rspec-collection_matchers
Collection cardinality matchers, extracted from rspec-expectations
https://github.com/rspec/rspec-collection_matchers
Keywords from Contributors
activerecord rspec activejob mvc rubygems crash-reporting rubocop ruby-gem sinatra rdoc
Last synced: about 20 hours ago
JSON representation
Repository metadata
Collection cardinality matchers, extracted from rspec-expectations
- Host: GitHub
- URL: https://github.com/rspec/rspec-collection_matchers
- Owner: rspec
- License: mit
- Created: 2013-07-22T04:51:15.000Z (over 12 years ago)
- Default Branch: main
- Last Pushed: 2025-02-15T23:39:25.000Z (about 1 year ago)
- Last Synced: 2025-12-22T07:52:24.515Z (2 months ago)
- Language: Ruby
- Size: 106 KB
- Stars: 193
- Watchers: 12
- Forks: 23
- Open Issues: 0
- Releases: 0
-
Metadata Files:
- Readme: README.md
- Changelog: Changelog.md
- Funding: .github/FUNDING.yml
- License: LICENSE.txt
README.md
RSpec::CollectionMatchers 
RSpec::CollectionMatchers lets you express expected outcomes on collections
of an object in an example.
expect(account.shopping_cart).to have_exactly(3).items
Install
Add this line to your application's Gemfile:
gem 'rspec-collection_matchers'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rspec-collection_matchers
Basic usage
First of all, you need to require rspec-collection matchers. Add the following line to your spec_helper.rb:
require 'rspec/collection_matchers'
Using rspec-collection_matchers you can match the number of items in a
collection directly, e.g.:
it 'matches number of items in a collection' do
expect([1,2,3]).to have_at_least(3).items
end
You can also match the number of items returned by a method on an object, e.g.:
class Cart
def initialize(*products)
@products = products
end
attr_reader :products
end
it 'matches number of items returned from a method' do
cart = Cart.new('product a', 'product b')
expect(cart).to have_at_most(2).products
end
The last line of the example expresses an expected outcome:
if cart.products.size <= 2 then the example passes, otherwise it fails with a message like:
expected at most 2 products, got 3
Available matchers
expect(collection).to have(n).items
expect(collection).to have_exactly(n).items
expect(collection).to have_at_most(n).items
expect(collection).to have_at_least(n).items
expect(collection).to have(:no).items
See also
Owner metadata
- Name: RSpec
- Login: rspec
- Email:
- Kind: organization
- Description:
- Website: http://rspec.info
- Location:
- Twitter:
- Company:
- Icon url: https://avatars.githubusercontent.com/u/22388?v=4
- Repositories: 18
- Last ynced at: 2024-03-25T19:34:00.441Z
- Profile URL: https://github.com/rspec
GitHub Events
Total
- Delete event: 1
- Pull request event: 2
- Watch event: 2
- Push event: 3
- Create event: 1
Last Year
- Watch event: 1
Committers metadata
Last synced: 1 day ago
Total Commits: 120
Total Committers: 15
Avg Commits per committer: 8.0
Development Distribution Score (DDS): 0.583
Commits in past year: 0
Committers in past year: 0
Avg Commits per committer in past year: 0.0
Development Distribution Score (DDS) in past year: 0.0
| Name | Commits | |
|---|---|---|
| Jon Rowe | h****o@j****k | 50 |
| Hugo Baraúna | h****a@p****r | 27 |
| Myron Marston | m****n@g****m | 13 |
| Bradley Schaefer | b****r@g****m | 12 |
| Olle Jonsson | o****n@g****m | 3 |
| Benoit Tigeot | b****t@h****m | 3 |
| Johnson Denen | j****n@m****m | 3 |
| Akira Matsuda | r****e@d****p | 2 |
| Phil Pirozhkov | h****o@f****u | 1 |
| Orien Madgwick | _@o****o | 1 |
| Matt Whipple | m****t@m****m | 1 |
| Kassio Borges | k****m@g****m | 1 |
| Ilya Vassilevsky | v****y@g****m | 1 |
| Claudio B | c****b | 1 |
| Siva Gollapalli | s****a@j****m | 1 |
Committer domains:
- joshsoftware.com: 1
- mattwhipple.com: 1
- orien.io: 1
- fili.pp.ru: 1
- dio.jp: 1
- manta.com: 1
- hopsandfork.com: 1
- plataformatec.com.br: 1
- jonrowe.co.uk: 1
Issue and Pull Request metadata
Last synced: 3 months ago
Total issues: 17
Total pull requests: 39
Average time to close issues: about 1 year
Average time to close pull requests: 8 months
Total issue authors: 14
Total pull request authors: 19
Average comments per issue: 4.76
Average comments per pull request: 2.41
Merged pull request: 33
Bot issues: 0
Bot pull requests: 0
Past year issues: 0
Past year pull requests: 2
Past year average time to close issues: N/A
Past year average time to close pull requests: 43 minutes
Past year issue authors: 0
Past year pull request authors: 1
Past year average comments per issue: 0
Past year average comments per pull request: 0.0
Past year merged pull request: 2
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- myronmarston (4)
- pvalena (1)
- Charizard (1)
- stamm (1)
- ivanovaleksey (1)
- amilligan (1)
- JonRowe (1)
- jaredbeck (1)
- hugobarauna (1)
- jscheid (1)
- ain (1)
- linkyndy (1)
- palfvin (1)
- KelvinMutuma (1)
Top Pull Request Authors
- JonRowe (12)
- myronmarston (5)
- amatsuda (4)
- olleolleolle (3)
- benoittgt (2)
- hugobarauna (2)
- krissi (1)
- vassilevsky (1)
- mwhipple (1)
- orien (1)
- claudiob (1)
- sivagollapalli (1)
- kassio (1)
- jdenen (1)
- soulcutter (1)
Top Issue Labels
- duplicate (1)
Top Pull Request Labels
Package metadata
- Total packages: 13
-
Total downloads:
- rubygems: 97,043,534 total
- Total docker downloads: 18,473,978
- Total dependent packages: 368 (may contain duplicates)
- Total dependent repositories: 5,129 (may contain duplicates)
- Total versions: 45
- Total maintainers: 1
gem.coop: rspec-collection_matchers
Collection cardinality matchers, extracted from rspec-expectations
- Homepage: https://github.com/rspec/rspec-collection_matchers
- Documentation: http://www.rubydoc.info/gems/rspec-collection_matchers/
- Licenses: MIT
- Latest release: 1.2.1 (published over 2 years ago)
- Last Synced: 2026-03-02T04:32:57.699Z (1 day ago)
- Versions: 12
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 48,520,529 Total
- Docker Downloads: 9,236,989
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 0.408%
- Downloads: 0.534%
- Docker downloads count: 1.096%
- Maintainers (1)
rubygems.org: rspec-collection_matchers
Collection cardinality matchers, extracted from rspec-expectations
- Homepage: https://github.com/rspec/rspec-collection_matchers
- Documentation: http://www.rubydoc.info/gems/rspec-collection_matchers/
- Licenses: MIT
- Latest release: 1.2.1 (published over 2 years ago)
- Last Synced: 2026-03-02T06:07:00.181Z (1 day ago)
- Versions: 12
- Dependent Packages: 368
- Dependent Repositories: 5,129
- Downloads: 48,523,005 Total
- Docker Downloads: 9,236,989
-
Rankings:
- Dependent packages count: 0.122%
- Dependent repos count: 0.442%
- Downloads: 0.525%
- Docker downloads count: 1.225%
- Average: 1.979%
- Stargazers count: 4.061%
- Forks count: 5.498%
- Maintainers (1)
proxy.golang.org: github.com/rspec/rspec-collection_matchers
- Homepage:
- Documentation: https://pkg.go.dev/github.com/rspec/rspec-collection_matchers#section-documentation
- Licenses: mit
- Latest release: v1.2.1 (published over 2 years ago)
- Last Synced: 2026-03-02T06:07:02.996Z (1 day ago)
- Versions: 11
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Stargazers count: 3.613%
- Forks count: 4.536%
- Average: 7.132%
- Dependent packages count: 9.576%
- Dependent repos count: 10.802%
ubuntu-23.04: ruby-rspec-collection-matchers
- Homepage: https://github.com/rspec/rspec-collection_matchers
- Licenses: mit
- Latest release: 1.2.0-2 (published 20 days ago)
- Last Synced: 2026-02-11T06:48:48.240Z (20 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
ubuntu-20.04: ruby-rspec-collection-matchers
- Homepage: https://github.com/rspec/rspec-collection_matchers
- Licenses:
- Latest release: 1.2.0-2 (published 18 days ago)
- Last Synced: 2026-02-13T07:22:03.814Z (18 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
ubuntu-23.10: ruby-rspec-collection-matchers
- Homepage: https://github.com/rspec/rspec-collection_matchers
- Licenses:
- Latest release: 1.2.0-2 (published 18 days ago)
- Last Synced: 2026-02-13T18:31:44.383Z (18 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
debian-11: ruby-rspec-collection-matchers
- Homepage: https://github.com/rspec/rspec-collection_matchers
- Documentation: https://packages.debian.org/bullseye/ruby-rspec-collection-matchers
- Licenses: mit
- Latest release: 1.2.0-2 (published 21 days ago)
- Last Synced: 2026-02-13T08:24:29.599Z (18 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
debian-10: ruby-rspec-collection-matchers
- Homepage: https://github.com/rspec/rspec-collection_matchers
- Documentation: https://packages.debian.org/buster/ruby-rspec-collection-matchers
- Licenses:
- Latest release: 1.1.2-1 (published 20 days ago)
- Last Synced: 2026-02-13T04:25:29.787Z (19 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
ubuntu-22.04: ruby-rspec-collection-matchers
- Homepage: https://github.com/rspec/rspec-collection_matchers
- Licenses:
- Latest release: 1.2.0-2 (published 18 days ago)
- Last Synced: 2026-02-13T13:24:50.805Z (18 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
debian-12: ruby-rspec-collection-matchers
- Homepage: https://github.com/rspec/rspec-collection_matchers
- Documentation: https://packages.debian.org/bookworm/ruby-rspec-collection-matchers
- Licenses:
- Latest release: 1.2.0-2 (published 19 days ago)
- Last Synced: 2026-02-12T23:40:06.962Z (19 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
debian-13: ruby-rspec-collection-matchers
- Homepage: https://github.com/rspec/rspec-collection_matchers
- Documentation: https://packages.debian.org/trixie/ruby-rspec-collection-matchers
- Licenses:
- Latest release: 1.2.0-2 (published 19 days ago)
- Last Synced: 2026-02-13T13:19:13.938Z (18 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
Dependencies
- aruba >= 0
- contracts = 0.15.0
- cucumber ~> 1.3.20
- cucumber >= 0
- i18n < 0.7.0
- json > 2.3.0
- json < 2
- rake ~> 12.3.2
- rake ~> 10.0.0
- rake ~> 11.0.0
- rake ~> 13.0.0
- term-ansicolor < 1.4.0
- tins ~> 1.6.0
- activemodel >= 3.0 development
- bundler >= 1.3 development
- rspec-expectations >= 2.99.0.beta1
- actions/checkout v4 composite
- actions/checkout v3 composite
- ruby/setup-ruby v1 composite
Score: 26.53572324112744