On Tue, Apr 22, 2014 at 4:34 AM, Remi Ferrand <
remi.mathieu.ferr...@gmail.com> wrote:

> Hi Nan,
>
> thanks for your answer.
> With this modification:
>
> diff --git a/spec/classes/puppetrspec_spec.rb
> b/spec/classes/puppetrspec_spec.rb
> index 9d06d79..80fae58 100644
> --- a/spec/classes/puppetrspec_spec.rb
> +++ b/spec/classes/puppetrspec_spec.rb
> @@ -22,7 +22,7 @@ describe 'puppetrspec', :type => :class do
>      context 'with ensure undef' do
>
>          let :params do {
> -            :ensure     => '# WHAT SHOULD WE USE HERE TO PASS PUPPET
> undef VALUE ?#'
> +            :ensure     =>  :undef
>          } end
>
>          it 'should have File with ensure absent' do
>
>
> it fails with this error:
>
> % rake spec
> /usr/bin/ruby -S rspec spec/classes/puppetrspec_spec.rb --color
> .F
>
> Failures:
>
>   1) puppetrspec with ensure undef should have File with ensure absent
>      Failure/Error: should contain_file(filename).with_ensure('absent')
>      Puppet::Error:
>        Could not parse for environment production: Syntax error at ':';
> expected '}' at line 4 on node ...
>      # ./spec/classes/puppetrspec_spec.rb:30
>
> Finished in 1.51 seconds
> 2 examples, 1 failure
>
> Failed examples:
>
> rspec ./spec/classes/puppetrspec_spec.rb:29 # puppetrspec with ensure
> undef should have File with ensure absent
>
>
> Same error with this modification:
>
> diff --git a/spec/classes/puppetrspec_spec.rb
> b/spec/classes/puppetrspec_spec.rb
> index 9d06d79..63faa11 100644
> --- a/spec/classes/puppetrspec_spec.rb
> +++ b/spec/classes/puppetrspec_spec.rb
> @@ -21,9 +21,9 @@ describe 'puppetrspec', :type => :class do
>
>      context 'with ensure undef' do
>
> -        let :params do {
> -            :ensure     => '# WHAT SHOULD WE USE HERE TO PASS PUPPET
> undef VALUE ?#'
> -        } end
> +        let(:params) {{
> +            :ensure     =>  :undef
> +        }}
>
>
> If you have any other idea, let me know :-)
>

So internally it appears to be :undef, and I thought that would work for
rspec, but clearly not.
https://github.com/puppetlabs/puppet/blob/master/spec/unit/parser/ast/leaf_spec.rb#L101

Trying to set it to Puppet::Parser::AST::Undef resulted in the wrong
behavior with "if $var {...}". I may have mixed this up with a puppet
function where I needed to return undef. I guess I shouldn't count on my
memory at this hour of the day.

Nan

-- 
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/CACqVBqBGogT4Fig6fsH5drRjyRPyJcTmnkxBYh2gSOYyfutaUg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to