nwops / puppet-retrospec

The only tool you need to generate puppet code, tests, modules, facts, types, providers, data and everything else.
https://www.retrospec-puppet.com/
GNU Affero General Public License v3.0
137 stars 27 forks source link

Resources not in spec file when using --enable-future-parser #44

Closed witjoh closed 8 years ago

witjoh commented 8 years ago

could be related to #34

If I remove the puppet4 stuff, it works without the -n option only. Installed using gem. ruby-2.1.7 [ x86_64 ] CentOS release 6.7 (Final) pupept 4.3.1 (gem)

logicminds commented 8 years ago

If your using puppet 4 you should use the enable future parser for now as current version won't produce as much but it will still significantly reduce the amount of work you need to do. #34 will solve this problem though.

witjoh commented 8 years ago

Thks For your reference : the result with future parser require 'spec_helper' require 'shared_contexts'

describe 'simplesamlphp' do

by default the hiera integration uses hiera data from the shared_contexts.rb file

but basically to mock hiera you first need to add a key/value pair

to the specific context in the spec/shared_contexts.rb file

Note: you can only use a single hiera context per describe/context block

rspec-puppet does not allow you to swap out hiera data on a per test block

include_context :hiera

below is the facts hash that gives you the ability to mock

facts on a per describe/context block. If you use a fact in your

manifest you should mock the facts below.

let(:facts) do {} end

below is a list of the resource parameters that you can override.

By default all non-required parameters are commented out,

while all required parameters will require you to add a value

let(:params) do { } end

add these two lines in a single test block to enable puppet and hiera debug mode

Puppet::Util::Log.level = :debug

Puppet::Util::Log.newdestination(:console)

end

logicminds commented 8 years ago

https://github.com/nwops/puppet-retrospec#future-parser-support

Yea, the parameters do get filled out but no resource tests will get created. This is by design / known issue and would be fixed by #34 . As you have figured out you can comment out the future parser code before the retrospec run.