I am getting an odd error when running rake spec on my module. The
functions work fine when setup in Puppet, but when I try to test it rspec
is kicking out an error about my $myarr arrays. When I comment it out, the
tests pass.
What they heck does this error mean and why does it complain when Puppet
uses it just fine?
The error I am getting is:
2) ssh::sshd_config should contain Service[myservice]
Failure/Error: is_expected.to contain_service('myservice')
Puppet::PreformattedError:
Evaluation Error: Error while evaluating a Function Call, no
implicit conversion of Hash into String at line 1:1 on node <mynode>
# :1:in `block in call_function'
# :in `stack'
# ./spec/classes/init_spec.rb:18:in `block (2 levels) in <top
(required)>'
# ------------------
# --- Caused by: ---
# TypeError:
# no implicit conversion of Hash into String
# :1:in `block in call_function'
I have an array defined as
$myarr = [ 'one', 'two', 'three' ]
in myparams.pp
In init.pp I have a pretty basic setup
class mymodule {
include mymodule::myparams
file { "/tmp/myfile":
ensure => present,
owner => "root",
group => "root",
mode => "0600",
before => Service["myservice"]
}
service { "myservice":
ensure => running,
subscribe => File["/tmp/myfile"],
}
}
My spec file has:
require 'spec_helper'
require 'puppetlabs_spec_helper/module_spec_helper'
require 'rspec-puppet-utils'
require 'hiera-puppet-helper'
require 'facter'
describe 'ssh::sshd_config' do
it do
is_expected.to contain_file('/tmp/myfile')
end
it do
is_expected.to contain_service('myservice')
end
end
--
You received this message because you are subscribed to the Google Groups
"Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-dev/7d0b0266-5abc-42aa-b9ee-e2aae7fc848a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.