How To Install rubygem-rspec-mocks on CentOS 8

rubygem-rspec-mocks is RSpec’s ’test double’ framework (mocks and stubs)

Introduction

In this tutorial we learn how to install rubygem-rspec-mocks on CentOS 8.

What is rubygem-rspec-mocks

rspec-mocks provides a test-double framework for rspec including support for method stubs, fakes, and message expectations.

We can use yum or dnf to install rubygem-rspec-mocks on CentOS 8. In this tutorial we discuss both methods but you only need to choose one of method to install rubygem-rspec-mocks.

Install rubygem-rspec-mocks on CentOS 8 Using dnf

Update yum database with dnf using the following command.

sudo dnf makecache --refresh

The output should look something like this:

CentOS Linux 8 - AppStream                                       43 kB/s | 4.3 kB     00:00    
CentOS Linux 8 - BaseOS                                          65 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - ContinuousRelease                               43 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - Extras                                          23 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - FastTrack                                       40 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - HighAvailability                                36 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - Plus                                            24 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - PowerTools                                      50 kB/s | 4.3 kB     00:00    
Extra Packages for Enterprise Linux Modular 8 - x86_64           13 kB/s | 9.2 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                   24 kB/s | 8.5 kB     00:00    
Metadata cache created.

After updating yum database, We can install rubygem-rspec-mocks using dnf by running the following command:

sudo dnf -y install rubygem-rspec-mocks

Install rubygem-rspec-mocks on CentOS 8 Using yum

Update yum database with yum using the following command.

sudo yum makecache --refresh

The output should look something like this:

CentOS Linux 8 - AppStream                                       43 kB/s | 4.3 kB     00:00    
CentOS Linux 8 - BaseOS                                          65 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - ContinuousRelease                               43 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - Extras                                          23 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - FastTrack                                       40 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - HighAvailability                                36 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - Plus                                            24 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - PowerTools                                      50 kB/s | 4.3 kB     00:00    
Extra Packages for Enterprise Linux Modular 8 - x86_64           13 kB/s | 9.2 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                   24 kB/s | 8.5 kB     00:00    
Metadata cache created.

After updating yum database, We can install rubygem-rspec-mocks using yum by running the following command:

sudo yum -y install rubygem-rspec-mocks

How To Uninstall rubygem-rspec-mocks on CentOS 8

To uninstall only the rubygem-rspec-mocks package we can use the following command:

sudo dnf remove rubygem-rspec-mocks

rubygem-rspec-mocks Package Contents on CentOS 8

/usr/share/gems/gems/rspec-mocks-3.7.0
/usr/share/gems/gems/rspec-mocks-3.7.0/Changelog.md
/usr/share/gems/gems/rspec-mocks-3.7.0/LICENSE.md
/usr/share/gems/gems/rspec-mocks-3.7.0/README.md
/usr/share/gems/gems/rspec-mocks-3.7.0/lib
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks.rb
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/any_instance
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/any_instance.rb
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/any_instance/chain.rb
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/any_instance/error_generator.rb
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/any_instance/expect_chain_chain.rb
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/any_instance/expectation_chain.rb
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/any_instance/message_chains.rb
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/any_instance/proxy.rb
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/any_instance/recorder.rb
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/any_instance/stub_chain.rb
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/any_instance/stub_chain_chain.rb
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/argument_list_matcher.rb
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/argument_matchers.rb
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/configuration.rb
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/error_generator.rb
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/example_methods.rb
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/instance_method_stasher.rb
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/marshal_extension.rb
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/matchers
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/matchers/expectation_customization.rb
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/matchers/have_received.rb
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/matchers/receive.rb
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/matchers/receive_message_chain.rb
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/matchers/receive_messages.rb
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/message_chain.rb
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/message_expectation.rb
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/method_double.rb
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/method_reference.rb
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/minitest_integration.rb
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/mutate_const.rb
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/object_reference.rb
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/order_group.rb
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/proxy.rb
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/space.rb
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/standalone.rb
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/syntax.rb
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/targets.rb
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/test_double.rb
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/verifying_double.rb
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/verifying_message_expectation.rb
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/verifying_proxy.rb
/usr/share/gems/gems/rspec-mocks-3.7.0/lib/rspec/mocks/version.rb
/usr/share/gems/specifications/rspec-mocks-3.7.0.gemspec

References

Summary

In this tutorial we learn how to install rubygem-rspec-mocks on CentOS 8 using yum and dnf.