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

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -