mocking - How to Mock a Custom Type in Rspec-Puppet -
i able test custom types
using rspec-puppet
due implementing answer of this question.
however, avoid create symlink custom folder
in every puppet-module mocking
cystom types
.
the question how mock custom puppet types in rspec-puppet.
i have found example regarding mocking of custom puppet function
looking example mock puppet custom types
.
puppet code
class vim::ubuntu::config { custom_multiple_files { 'line_numbers': ensure => 'present', parent_dir => '/home', file_name => '.vimrc', line => 'set number'; } }
rspec-puppet code
require 'spec_helper' describe "vim::ubuntu::config" ? end
a place go looking examples on mocking collection of puppet's own unit tests.
i'm not sure if there specialties needs considered, within puppet's spec test, mocking works this:
let(:type) { puppet::type.type(:custom_file_line) } "should whatever" type.stubs(:retrieve).returns <value> # perhaps needed puppet::type.stubs(:type).with(:custom_file_line).returns(type)
from understand, moccha style mocking. in plain rspec, mocking/stubbing bit more involved, may necessary rspec-puppet
.
Comments
Post a Comment