Skip to content

Instantly share code, notes, and snippets.

@evidex
Created June 15, 2016 14:30
Show Gist options
  • Save evidex/e2901099d6214c335959e07e71ed713e to your computer and use it in GitHub Desktop.
Save evidex/e2901099d6214c335959e07e71ed713e to your computer and use it in GitHub Desktop.
rspec-question
------ foo.pp -------
class foo (
$some_string = $::foo::params::some_string_default,
) inherits foo::params {
validate_string($some_string)
include foo::bar
}
------ bar.pp -------
class foo::bar {
notify { $some_string: }
}
@evidex
Copy link
Author

evidex commented Jun 15, 2016

# manifests/init.pp
class foo (
  $some_string = $::foo::params::some_string_default,
) inherits foo::params {
  validate_string($some_string)
  include foo::bar
}
# manifests/bar.pp
class foo::bar {
  notify { $foo::some_string: }
}
# manifests/params.pp
class foo::params {
  $some_string_default = 'baz'
}
# spec/classes/foo_spec.rb
require 'spec_helper'
describe 'foo' do
  it { is_expected.to contain_notify('baz') }
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment