9 best Ruby Mock libraries in 2024

share link

by marketing.admin@openweaver.com dot icon Updated: Mar 12, 2023

technology logo
technology logo

Guide Kit Guide Kit  

In software development, mock objects simulate the behavior and functionality of real objects, often to simplify unit testing. It is an object that mimics the behavior of another object, typically to simplify the testing of a class. A mock object can also be used to simulate how a client will use an API that hasn't yet been built or isn't ready for use. The procedure is a critical element of extreme programming, which relies on frequent releases in short development cycles and emphasizes comprehensive unit testing to ensure application stability. These are the 9 best Ruby Mock libraries in 2022, pact-ruby - Enables consumer-driven contract testing; Mocha - a mocking and stubbing library for Ruby; RSpec's - 'test double' framework, with support for stubbing and mocking; stripe-ruby-mock - A mocking library for testing stripe ruby.

pact-rubyby pact-foundation

Ruby doticonstar image 2088 doticonVersion:v1.62.0doticon
License: Permissive (MIT)

Enables consumer driven contract testing, providing a mock service and DSL for the consumer project, and interaction playback and verification for the service provider project.

Support
    Quality
      Security
        License
          Reuse

            pact-rubyby pact-foundation

            Ruby doticon star image 2088 doticonVersion:v1.62.0doticon License: Permissive (MIT)

            Enables consumer driven contract testing, providing a mock service and DSL for the consumer project, and interaction playback and verification for the service provider project.
            Support
              Quality
                Security
                  License
                    Reuse

                      duckrailsby iridakos

                      Ruby doticonstar image 1712 doticonVersion:v2.1.9doticon
                      License: Permissive (MIT)

                      Development tool to mock API endpoints quickly and easily (docker image available)

                      Support
                        Quality
                          Security
                            License
                              Reuse

                                duckrailsby iridakos

                                Ruby doticon star image 1712 doticonVersion:v2.1.9doticon License: Permissive (MIT)

                                Development tool to mock API endpoints quickly and easily (docker image available)
                                Support
                                  Quality
                                    Security
                                      License
                                        Reuse

                                          mochaby freerange

                                          Ruby doticonstar image 1154 doticonVersion:Currentdoticon
                                          License: Others (Non-SPDX)

                                          Mocha is a mocking and stubbing library for Ruby

                                          Support
                                            Quality
                                              Security
                                                License
                                                  Reuse

                                                    mochaby freerange

                                                    Ruby doticon star image 1154 doticonVersion:Currentdoticon License: Others (Non-SPDX)

                                                    Mocha is a mocking and stubbing library for Ruby
                                                    Support
                                                      Quality
                                                        Security
                                                          License
                                                            Reuse

                                                              rspec-mocksby rspec

                                                              Ruby doticonstar image 1106 doticonVersion:v2.14.6doticon
                                                              License: Permissive (MIT)

                                                              RSpec's 'test double' framework, with support for stubbing and mocking

                                                              Support
                                                                Quality
                                                                  Security
                                                                    License
                                                                      Reuse

                                                                        rspec-mocksby rspec

                                                                        Ruby doticon star image 1106 doticonVersion:v2.14.6doticon License: Permissive (MIT)

                                                                        RSpec's 'test double' framework, with support for stubbing and mocking
                                                                        Support
                                                                          Quality
                                                                            Security
                                                                              License
                                                                                Reuse

                                                                                  stripe-ruby-mockby stripe-ruby-mock

                                                                                  Ruby doticonstar image 845 doticonVersion:3.1.0.rc2doticon
                                                                                  License: Permissive (MIT)

                                                                                  A mocking library for testing stripe ruby

                                                                                  Support
                                                                                    Quality
                                                                                      Security
                                                                                        License
                                                                                          Reuse

                                                                                            stripe-ruby-mockby stripe-ruby-mock

                                                                                            Ruby doticon star image 845 doticonVersion:3.1.0.rc2doticon License: Permissive (MIT)

                                                                                            A mocking library for testing stripe ruby
                                                                                            Support
                                                                                              Quality
                                                                                                Security
                                                                                                  License
                                                                                                    Reuse

                                                                                                      active_mockerby zeisler

                                                                                                      Ruby doticonstar image 497 doticonVersion:Currentdoticon
                                                                                                      License: Permissive (MIT)

                                                                                                      Generate mocks from ActiveRecord models for unit tests that run fast because they don’t need to load Rails or a database.

                                                                                                      Support
                                                                                                        Quality
                                                                                                          Security
                                                                                                            License
                                                                                                              Reuse

                                                                                                                active_mockerby zeisler

                                                                                                                Ruby doticon star image 497 doticonVersion:Currentdoticon License: Permissive (MIT)

                                                                                                                Generate mocks from ActiveRecord models for unit tests that run fast because they don’t need to load Rails or a database.
                                                                                                                Support
                                                                                                                  Quality
                                                                                                                    Security
                                                                                                                      License
                                                                                                                        Reuse
                                                                                                                          Ruby doticonstar image 444 doticonVersion:v0.36.0doticon
                                                                                                                          License: Others (Non-SPDX)

                                                                                                                          Mock Redis gem for Ruby

                                                                                                                          Support
                                                                                                                            Quality
                                                                                                                              Security
                                                                                                                                License
                                                                                                                                  Reuse

                                                                                                                                    mock_redisby sds

                                                                                                                                    Ruby doticon star image 444 doticonVersion:v0.36.0doticon License: Others (Non-SPDX)

                                                                                                                                    Mock Redis gem for Ruby
                                                                                                                                    Support
                                                                                                                                      Quality
                                                                                                                                        Security
                                                                                                                                          License
                                                                                                                                            Reuse

                                                                                                                                              mock5by rwz

                                                                                                                                              Ruby doticonstar image 306 doticonVersion:Currentdoticon
                                                                                                                                              License: Permissive (MIT)

                                                                                                                                              Create and manage API mocks with Sinatra

                                                                                                                                              Support
                                                                                                                                                Quality
                                                                                                                                                  Security
                                                                                                                                                    License
                                                                                                                                                      Reuse

                                                                                                                                                        mock5by rwz

                                                                                                                                                        Ruby doticon star image 306 doticonVersion:Currentdoticon License: Permissive (MIT)

                                                                                                                                                        Create and manage API mocks with Sinatra
                                                                                                                                                        Support
                                                                                                                                                          Quality
                                                                                                                                                            Security
                                                                                                                                                              License
                                                                                                                                                                Reuse

                                                                                                                                                                  spyby ryanong

                                                                                                                                                                  Ruby doticonstar image 126 doticonVersion:Currentdoticon
                                                                                                                                                                  License: Permissive (MIT)

                                                                                                                                                                  A simple opinionated mocking framework. All the features of rspec-mocks and more in half the code.

                                                                                                                                                                  Support
                                                                                                                                                                    Quality
                                                                                                                                                                      Security
                                                                                                                                                                        License
                                                                                                                                                                          Reuse

                                                                                                                                                                            spyby ryanong

                                                                                                                                                                            Ruby doticon star image 126 doticonVersion:Currentdoticon License: Permissive (MIT)

                                                                                                                                                                            A simple opinionated mocking framework. All the features of rspec-mocks and more in half the code.
                                                                                                                                                                            Support
                                                                                                                                                                              Quality
                                                                                                                                                                                Security
                                                                                                                                                                                  License
                                                                                                                                                                                    Reuse

                                                                                                                                                                                      See similar Kits and Libraries