As Jeff said, ideally you wouldn't have any cross-module dependencies, but 
everyone still does it.  

There's a couple of ways you can solve this issue at the moment.  The first 
(and my preferred way) is to setup a fixtures directory as described in 
http://bombasticmonkey.com/2012/03/02/automatically-test-your-puppet-modules-with-travis-ci/
 and then drop your apt module into spec/fixtures/modules/apt so that it's 
available to rspec-puppet.   

The other option is to define a stub apt::source type like so

```
describe 'foo::bar' do
  let(:pre_condition) { "define apt::source($param1, $param2…) {}" }

  it { should contain_apt__source('baz') }
end
```

Cheers,
Tim


On Thursday, 8 March 2012 at 3:22 AM, Jeff McCune wrote:

> On Tue, Mar 6, 2012 at 10:53 PM, R. Tyler Croy <ty...@monkeypox.org 
> (mailto:ty...@monkeypox.org)> wrote:
> > My module now depends on the puppetlabs/puppet-apt module for supporting
> > Debian/Ubuntu hosts, doing this however broke all my debian/ubuntu related
> > rspec-puppet tests.
> >  
> > Is there a reasonable way to mock out resources (like apt::source, etc) to 
> > just
> > test that my classes are doing what they should be doing?
>  
> Not that I know of.  rspec-puppet is testing the catalog itself and we don't 
> have a clean way to put mock resources in the catalog.
>  
> What's the breakage look like?  I usually treat this sort of issue as a code 
> smell.  Ideally, one module will simply require Class resources from other 
> modules rather than specific resources inside the class.  In this situation 
> all you need to do is declare a class with the same name in your spec tests 
> to satisfy the dependency.
>  
> Make sense?
>  
> -Jeff
>  
> --  
> You received this message because you are subscribed to the Google Groups 
> "Puppet Users" group.
> To post to this group, send email to puppet-users@googlegroups.com 
> (mailto:puppet-users@googlegroups.com).
> To unsubscribe from this group, send email to 
> puppet-users+unsubscr...@googlegroups.com 
> (mailto:puppet-users+unsubscr...@googlegroups.com).
> For more options, visit this group at 
> http://groups.google.com/group/puppet-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to