On this page
Overview
RSpec is a BDD testing toolkit for Ruby. The monorepo contains rspec-core for execution structure, rspec-expectations for expressing outcomes, rspec-mocks for stubs and test doubles, and rspec-support for shared internals. Installing the rspec gem normally brings core, expectations, and mocks together.
Features and best fit
Based on official documentation; not hands-on tested · Content checked:
Key features
Describe behavior with examples and readable expectations
Use describe for example groups, it for individual behavior, and expect(...).to ... for assertions so specs can also read as executable descriptions of the code.
Sources: [2]
Best fit
Fits Ruby libraries and applications that want a shared unit and behavior testing DSL
It is useful for Ruby projects that want readable specs, command-line filtering, and flexible output while keeping test intent close to application behavior. Rails-specific integration is provided separately by rspec-rails.
Sources: [2]
Before adoption
Keep the 4.0 beta on main separate from the stable 3.13 line
The main branch currently reports 4.0.0.beta1, while component changelogs compare main against stable 3.13 releases. Production projects that want stable behavior should constrain the 3.13 line rather than assuming beta breaking changes are already stable.
Choose Rails integration separately from the RSpec core gems
This monorepo contains the core RSpec gems, while Rails integration lives in the separate rspec-rails project and gem. Rails applications should verify that integration's compatibility independently.
Sources: [2]
Official sources
- [1]rspec/rspec repository(2026-09-30)
- [2]RSpec monorepo README(2026-09-30)
- [3]RSpec Core gemspec(2026-09-30)
- [4]RSpec Core changelog(2026-09-30)
- [5]RSpec Mocks changelog(2026-09-30)
- [6]RSpec MIT license(2026-09-30)
Supplemental curator note
RSpec separates the runner, matchers, and mocks into focused gems while the regular rspec gem installs the common set together. Since main is currently on the 4.0 beta line, existing projects should pin stable 3.13 intentionally rather than drifting into beta behavior.
Try it in 3 steps
- 1
Install the stable RSpec 3.13 line
The main branch is on the 4.0 beta line, so constrain production use to the stable 3.13 series.
gem install rspec -v '~> 3.13' - 2
Create a minimal spec
Save an example and expectation in a file such as spec/calculator_spec.rb.
RSpec.describe Calculator do it "adds numbers" do expect(1 + 2).to eq(3) end end - 3
Run the spec
Use the RSpec runner to execute the target file and inspect example and failure output.
rspec spec/calculator_spec.rb
Growth
Growth trends · Last 30 days
117 Stars
Trend data is still being collected.
Built with
Categories and tags
Categories
GitHub data
GitHub dataView detailed GitHub data
Related information
Write a related articleShare a guide or use case for this OSS in Markdown. Articles are published after administrator approval.
Explore next
- NUnit2,627 Stars
1 shared tag(s) · 2 shared category(s)
Write .NET fixtures, parameterized tests, and constraint-based assertions in an attribute-driven test framework
C# - fake-indexeddb695 Stars
1 shared tag(s) · 2 shared category(s)
recreate the IndexedDB API in memory for Node.js tests
JavaScript - Jekyll51,700 Stars
1 shared tag(s) · 1 shared category(s) · Same language
generate blog-aware static sites from Markdown and Liquid
Ruby - Homebrew49,828 Stars
1 shared tag(s) · 1 shared category(s) · Same language
manage macOS and Linux software through the
Rubybrewpackage workflow - Vagrant27,211 Stars
1 shared tag(s) · 1 shared category(s) · Same language
define portable development environments across providers with a Vagrantfile
Ruby - Aider49,251 Stars
1 shared tag(s) · 1 shared category(s)
edit code from the terminal with repository-wide context
Python
Report incorrect information
Tell us if any listing information is incorrect or outdated.