A curated list of awesome RSpec-related resources
- RSpec Style Guide
- Even better specs - An opinionated set of best practices to support the creation of tests that are easy to read and maintain.
- rubocop-rspec
- rubocop-factory_bot
- How to Test Rails Models with RSpec
- How to Use Custom RSpec Matchers to Specify Behaviour
- Using RSpec Metadata
- action_mailer_matchers - RSpec matchers to test Rails' common ActionMailer functionality.
- active_record_change_matchers - Custom RSpec matchers for ActiveRecord record creation.
- db-query-matchers - RSpec matchers for database queries made by ActiveRecord.
- mongoid-rspec - RSpec matchers for Mongoid.
- human_time - Time and date comparisons for humans.
- n_plus_one_control - Matchers to ensure code doesn't produce N+1 queries.
- pundit-matchers - A set of RSpec matchers for testing Pundit authorisation policies.
- resque_spec - A test double of Resque for RSpec.
- rspec-any_of - Provides
any_of
andall_of
matchers. - rspec-graphql_matchers - GraphQL matchers.
- rspec-json_matchers - A collection of RSpec matchers for testing JSON data.
- rspec-benchmark - Performance testing matchers for RSpec.
- rspec-sidekiq - Simple testing of Sidekiq jobs via a collection of matchers and helpers.
- rspec-sqlimit - RSpec matcher to control SQL queries made by block of code.
- shoulda-matchers - One-liners to test common Rails functionality.
- active_mocker - Creates stub classes from any ActiveRecord model.
- bunny-mock - A mock client for RabbitMQ modeled after the Bunny client in ruby.
- mock_redis -MockRedis provides the same interface as redis-rb, but it stores its data in memory instead of talking to a Redis server.
- mock5 - Create and manage API mocks with Sinatra.
- moctail - A mocking library for Ruby built with modern Ruby 3 APIs and with first-class support for type checking with Sorbet.
- mosoco - A minimalist stub & mock library.
- rspec-stubbed_env - Simple helper method to stub ENV values within RSpec tests.
- resque-mock - Resque mocking without redis.
- ruby-dns-mock - Mimic any DNS records for your test environment with fake DNS server.
- ruby-smtp-mock - Mimic any SMTP server behaviour for your test environment with fake SMTP server.
- spy - A simple opinionated mocking framework.
- stripe-ruby-mock - A mocking library for testing Stripe integration.
- stub_shell - Helps you to test your libraries that interact with the system through the Kernel backquote and system methods.
- testftpd - Simple FTP server written in pure Ruby, allowing integration testing of FTP client code without mocks and stubs.
- verified_double - Contract tests for mocks.
- flatware - A parallel test runner for RSpec and Cucumber with pretty output.
- knapsack - Knapsack splits tests evenly across parallel CI nodes to run fast CI build and save you time.
- parallel_tests - Speedup tests by running parallel on multiple CPU cores.
- rspec-distrib - Run specs in parallel on multiple machines.
- rspecq - Distribute and run RSpec suites among parallel workers; for faster CI builds.
- test-queue - Parallel test runner for CI environments
- turbo_tests - Like parallel_tests but with incremental summarized output.
- chefspec - Write RSpec examples and generate coverage reports for Chef recipes.
- crystallball - Regression Test Selection library for your RSpec test suite.
- database_cleaner - Strategies for cleaning databases in Ruby. Can be used to ensure a clean state for testing.
- database_rewinder - Minimalist and ultra-fast database cleaner.
- dockerspec - A small Ruby Gem to run RSpec and Serverspec, Infrataster and Capybara tests against Dockerfiles or Docker images easily.
- factory_bot - A library for building database records.
- factory_bot_instruments - Instruments for benchmarking, tracing, and debugging Factory Girl models.
- factory_trace - Simple tool to maintain factories and traits from FactoryBot.
- impersonator - Ruby library to record and replay object interactions.
- mutant - Mutation testing.
- retest - A simple CLI to watch file changes and run their matching ruby specs.
- rspectre - Tool to remove unused parts of the specs.
- rspec_tracer - RSpec Tracer is a specs dependency analyzer, flaky tests detector, tests accelerator, and coverage reporter tool.
- rspec-wait - Wait for conditions in RSpec.
- super-diff - A more helpful way to view differences between complex data structures in RSpec.
- test-prof - Tools to analyze test suite performance +helpers to write faster tests.
- vcr - Record your test suite's HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests.
- with_model - Dynamically build an Active Record model (with table) within a test context.
- yardspec Run RSpec examples embedded in yard
- zapata - An Automatic Automated Test Writer