Testing with RSpec using the PDK
To take this initial validation and compilation testing further at the unit test level, RSpec can be used to test the behavior and logic of modules, while ServerSpec can be used to test at the system integration level.
RSpec is a Ruby framework for testing Ruby code and is written in a domain-specific language (DSL) to make it easier to read. The rspec-puppet
test is an implementation of RSpec, specifically designed for testing Puppet modules.
Note
It is important to note that the current project code is available at https://github.com/puppetlabs/rspec-puppet, forked from https://github.com/rodjek/rspec-puppet, with core guides and documentation available at http://rspec-puppet.com/.
When users start using RSpec, some may feel that it is just mimicking the Puppet code but in a different language. RSpec runs through the different logic and behavior of your Puppet code and ensures that the correct catalogs and output will be produced in various...