How To Install rubygem-mocha on CentOS 8

rubygem-mocha is Mocking and stubbing library

Introduction

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

What is rubygem-mocha

Mocking and stubbing library with JMock/SchMock syntax, which allows mocking and stubbing of methods on real (non-mock) classes.

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

Install rubygem-mocha 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-mocha using dnf by running the following command:

sudo dnf -y install rubygem-mocha

Install rubygem-mocha 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-mocha using yum by running the following command:

sudo yum -y install rubygem-mocha

How To Uninstall rubygem-mocha on CentOS 8

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

sudo dnf remove rubygem-mocha

rubygem-mocha Package Contents on CentOS 8

/usr/share/gems/gems/mocha-1.1.0
/usr/share/gems/gems/mocha-1.1.0/COPYING.md
/usr/share/gems/gems/mocha-1.1.0/MIT-LICENSE.md
/usr/share/gems/gems/mocha-1.1.0/README.md
/usr/share/gems/gems/mocha-1.1.0/RELEASE.md
/usr/share/gems/gems/mocha-1.1.0/bin
/usr/share/gems/gems/mocha-1.1.0/bin/build-matrix
/usr/share/gems/gems/mocha-1.1.0/lib
/usr/share/gems/gems/mocha-1.1.0/lib/mocha
/usr/share/gems/gems/mocha-1.1.0/lib/mocha.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/any_instance_method.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/api.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/argument_iterator.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/backtrace_filter.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/cardinality.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/central.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/change_state_side_effect.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/class_method.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/class_methods.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/configuration.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/debug.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/deprecation.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/detection
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/detection/mini_test.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/detection/test_unit.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/exception_raiser.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/expectation.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/expectation_error.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/expectation_error_factory.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/expectation_list.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/hooks.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/in_state_ordering_constraint.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/inspect.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/instance_method.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/integration
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/integration.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/integration/assertion_counter.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/integration/mini_test
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/integration/mini_test.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/integration/mini_test/adapter.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/integration/mini_test/exception_translation.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/integration/mini_test/nothing.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/integration/mini_test/version_13.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/integration/mini_test/version_140.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/integration/mini_test/version_141.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/integration/mini_test/version_142_to_172.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/integration/mini_test/version_200.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/integration/mini_test/version_201_to_222.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/integration/mini_test/version_2110_to_2111.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/integration/mini_test/version_2112_to_320.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/integration/mini_test/version_230_to_2101.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/integration/monkey_patcher.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/integration/test_unit
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/integration/test_unit.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/integration/test_unit/adapter.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/integration/test_unit/gem_version_200.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/integration/test_unit/gem_version_201_to_202.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/integration/test_unit/gem_version_203_to_220.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/integration/test_unit/gem_version_230_to_250.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/integration/test_unit/nothing.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/integration/test_unit/ruby_version_185_and_below.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/integration/test_unit/ruby_version_186_and_above.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/is_a.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/logger.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/method_matcher.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/mini_test.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/mock.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/mockery.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/module_method.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/module_methods.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/multiple_yields.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/names.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/no_yields.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/object_methods.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/parameter_matchers
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/parameter_matchers.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/parameter_matchers/all_of.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/parameter_matchers/any_of.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/parameter_matchers/any_parameters.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/parameter_matchers/anything.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/parameter_matchers/base.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/parameter_matchers/equals.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/parameter_matchers/has_entries.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/parameter_matchers/has_entry.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/parameter_matchers/has_key.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/parameter_matchers/has_value.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/parameter_matchers/includes.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/parameter_matchers/instance_of.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/parameter_matchers/is_a.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/parameter_matchers/kind_of.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/parameter_matchers/not.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/parameter_matchers/object.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/parameter_matchers/optionally.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/parameter_matchers/query_string.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/parameter_matchers/regexp_matches.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/parameter_matchers/responds_with.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/parameter_matchers/yaml_equivalent.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/parameters_matcher.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/pretty_parameters.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/receivers.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/return_values.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/sequence.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/setup.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/single_return_value.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/single_yield.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/standalone.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/state_machine.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/stubbing_error.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/test_unit.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/thrower.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/unexpected_invocation.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/version.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha/yield_parameters.rb
/usr/share/gems/gems/mocha-1.1.0/lib/mocha_standalone.rb
/usr/share/gems/specifications/mocha-1.1.0.gemspec

References

Summary

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