Beaker-rspec problems using shared_examples

40 views
Skip to first unread message

Atom Powers

unread,
Sep 12, 2014, 1:49:16 PM9/12/14
to puppet...@googlegroups.com
I'm trying to move some of my beaker-rspec tests into shared_examples. It appears that I'm loosing something when I do that.

I'm hoping somebody with more rspec experience than me can shed some light on what I need to do to get this to work.

The error looks like this:
----
Puppet::Error: Could not parse for environment production: No file(s) found for import of '/etc/puppet/manifests/site.pp' at line 4 on node test-node

#### Works
describe 'puppet apply' do
  context 'with role webserver' do
    manifest = "class { 'profiles::webserver': }"
    it 'should work idempotently with no errors' do
      apply_manifest(manifest, :catch_failures => true)
      apply_manifest(manifest, :catch_changes  => true)
    end
    describe service('nginx') do
      it { should be_enabled }
      it { should be_running }
    end
  end
end

#### Doesn't Work
shared_examples 'profiles::nginx' do
  describe service('puppet') do
    it { should be_enabled }
    it { should be_running }
  end
end
describe 'puppet apply' do
  context 'with role webserver' do
    manifest = "class { 'profiles::webserver': }"
    it 'should work idempotently with no errors' do
      apply_manifest(manifest, :catch_failures => true)
      apply_manifest(manifest, :catch_changes  => true)
    end
    include_examples 'profiles::nginx'
  end
end

--
Perfection is just a word I use occasionally with mustard.
--Atom Powers--
Reply all
Reply to author
Forward
0 new messages