Hi Peter,

See if this helps
https://github.com/onyxpoint/puppet-gpasswd/blob/master/spec/unit/provider/group/gpasswd_spec.rb

Thanks,

Trevor

On Fri, Aug 5, 2016 at 8:04 AM, Peter Berghold <salty.cowd...@gmail.com>
wrote:

> I have this wonderful module that calls various custom functions that I've
> written that I'm trying to adopt RSpec testing for.  After seeing it crash
> and burn with "function unknown" errors I took a rather meandering path and
> arrived here: https://github.com/TomPoulton/rspec-puppet-unit-testing
>
> So I attempted to follow the instructions given and I ended up with a
> result like this:
>
> ------------- 8< snip!   file: spec/classes/init_spec.rb
> --------------------------------------------
>
> require 'spec_helper'
> describe 'ourbind' do
>
>   let!(:ipdot2dash) { MockFunction.new('ipdot2dash') { |f|
>       f.stubbed.with('10.1.2.3').returns('10-1-2-3')
>     }
>   }
>   context 'with defaults for all parameters' do
>     it do
>       ipdot2dash.stubs(:call).with('10.1.2.3').returns('10-1-2-3')
>       should compile
>       should contain_class('ourbind')
>
>     end
>   end
> end
>
> ------------------ 8< snip! 8< ------------------------------
> ----------------------------------
>
> I run "rake spec" and I get this (at least to me) undecipherable message:
>
> --------------8< error spew 8<----------------------------
> -----------------------------------
>
>     Failure/Error: should compile
>
>      Mocha::ExpectationError:
>        unexpected invocation: #<RSpecPuppetUtils::
> MockFunction:0x2b67950>.call(['', '21'])
>        satisfied expectations:
>        - allowed any number of times, not yet invoked:
> #<Puppet::Util::Feature:0x214fc38>.root?(any_parameters)
>        - allowed any number of times, not yet invoked: #<RSpecPuppetUtils::
> MockFunction:0x2b67950>.call('10.1.2.3')
>        - allowed any number of times, not yet invoked: #<RSpecPuppetUtils::
> MockFunction:0x2b67950>.execute('10.1.2.3')
>
> -----------------8< snip! 8< ------------------------------
> ----------------------------------------
>
>
> Apparently I'm missing something here, what's it trying to tell me and how
> do I fix it?
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to puppet-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/puppet-users/CAArvnv2mhr7qyOhgRJWQ%2Bfr9hm88gdhmCB1AYB2aeqq1TFCA%
> 2BA%40mail.gmail.com
> <https://groups.google.com/d/msgid/puppet-users/CAArvnv2mhr7qyOhgRJWQ%2Bfr9hm88gdhmCB1AYB2aeqq1TFCA%2BA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Trevor Vaughan
Vice President, Onyx Point, Inc
(410) 541-6699 x788

-- This account not approved for unencrypted proprietary information --

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CANs%2BFoVkgH7uz-VkZqiE9ie3pA3oz53dvjj7MPq5xmO2-d9Ysg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to