rspec-puppet-womble 0.1.6.womble1 → 0.1.6.womble2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/Gemfile +8 -0
  2. data/LICENSE +20 -0
  3. data/README.md +357 -0
  4. data/Rakefile +7 -0
  5. data/lib/rspec-puppet.rb +47 -0
  6. data/lib/rspec-puppet/errors.rb +46 -0
  7. data/lib/rspec-puppet/example.rb +27 -0
  8. data/lib/rspec-puppet/example/class_example_group.rb +10 -0
  9. data/lib/rspec-puppet/example/define_example_group.rb +10 -0
  10. data/lib/rspec-puppet/example/function_example_group.rb +46 -0
  11. data/lib/rspec-puppet/example/host_example_group.rb +10 -0
  12. data/lib/rspec-puppet/matchers.rb +6 -0
  13. data/lib/rspec-puppet/matchers/compile.rb +133 -0
  14. data/lib/rspec-puppet/matchers/count_generic.rb +73 -0
  15. data/lib/rspec-puppet/matchers/create_generic.rb +156 -0
  16. data/lib/rspec-puppet/matchers/dynamic_matchers.rb +17 -0
  17. data/lib/rspec-puppet/matchers/include_class.rb +19 -0
  18. data/lib/rspec-puppet/matchers/parameter_matcher.rb +110 -0
  19. data/lib/rspec-puppet/matchers/run.rb +94 -0
  20. data/lib/rspec-puppet/setup.rb +167 -0
  21. data/lib/rspec-puppet/support.rb +165 -0
  22. data/rspec-puppet-womble.gemspec +18 -0
  23. data/spec/classes/array_spec.rb +74 -0
  24. data/spec/classes/boolean_regexp_spec.rb +13 -0
  25. data/spec/classes/boolean_spec.rb +11 -0
  26. data/spec/classes/cycle_bad_spec.rb +5 -0
  27. data/spec/classes/cycle_good_spec.rb +5 -0
  28. data/spec/classes/escape_spec.rb +7 -0
  29. data/spec/classes/hash_spec.rb +68 -0
  30. data/spec/classes/sysctl_common_spec.rb +83 -0
  31. data/spec/defines/escape_def_spec.rb +8 -0
  32. data/spec/defines/sysctl_before_spec.rb +25 -0
  33. data/spec/defines/sysctl_spec.rb +21 -0
  34. data/spec/fixtures/manifests/site.pp +26 -0
  35. data/spec/fixtures/modules/boolean/manifests/init.pp +12 -0
  36. data/spec/fixtures/modules/cycle/manifests/bad.pp +8 -0
  37. data/spec/fixtures/modules/cycle/manifests/good.pp +7 -0
  38. data/spec/fixtures/modules/cycle/manifests/init.pp +0 -0
  39. data/spec/fixtures/modules/escape/manifests/def.pp +6 -0
  40. data/spec/fixtures/modules/escape/manifests/init.pp +6 -0
  41. data/spec/fixtures/modules/structured_data/manifests/def.pp +5 -0
  42. data/spec/fixtures/modules/structured_data/manifests/init.pp +5 -0
  43. data/spec/fixtures/modules/sysctl/manifests/init.pp +39 -0
  44. data/spec/functions/split_spec.rb +30 -0
  45. data/spec/hosts/bad_dep_host_spec.rb +5 -0
  46. data/spec/hosts/foo_spec.rb +6 -0
  47. data/spec/hosts/good_dep_host_spec.rb +5 -0
  48. data/spec/hosts/testhost_spec.rb +5 -0
  49. data/spec/spec_helper.rb +6 -0
  50. metadata +50 -1
@@ -0,0 +1,5 @@
1
+ class structured_data($data) {
2
+ structured_data::def { 'thing':
3
+ data => $data,
4
+ }
5
+ }
@@ -0,0 +1,39 @@
1
+ class sysctl::common ($test_param = 'yes') {
2
+ exec { 'sysctl/reload':
3
+ command => '/sbin/sysctl -p /etc/sysctl.conf',
4
+ refreshonly => true,
5
+ returns => [0, 2],
6
+ }
7
+ }
8
+
9
+ define sysctl($value) {
10
+ include sysctl::common
11
+
12
+ augeas { "sysctl/${name}":
13
+ context => '/files/etc/sysctl.conf',
14
+ changes => "set ${name} '${value}'",
15
+ onlyif => "match ${name}[.='${value}'] size == 0",
16
+ notify => Exec['sysctl/reload'],
17
+ }
18
+ }
19
+
20
+ class boolean($bool) {
21
+ $real_bool = $bool ? {
22
+ true => false,
23
+ false => true,
24
+ }
25
+
26
+ if ($real_bool) {
27
+ notify {"bool testing":
28
+ message => "This will print when \$bool is false."
29
+ }
30
+ }
31
+ }
32
+
33
+ define sysctl::before($value) {
34
+ Class['sysctl::common'] -> Sysctl::Before[$name]
35
+
36
+ notify {"message-${name}":
37
+ message => "This should print if the class is here first."
38
+ }
39
+ }
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'split' do
4
+ it { should run.with_params('aoeu', 'o').and_return(['a', 'eu']) }
5
+ it { should_not run.with_params('foo').and_raise_error(Puppet::DevError) }
6
+
7
+ if Puppet.version =~ /\A3\.1/
8
+ expected_error = ArgumentError
9
+ else
10
+ expected_error = Puppet::ParseError
11
+ end
12
+
13
+ it { should run.with_params('foo').and_raise_error(expected_error) }
14
+
15
+ it { should run.with_params('foo').and_raise_error(expected_error, /number of arguments/) }
16
+
17
+ it { should run.with_params('foo').and_raise_error(/number of arguments/) }
18
+
19
+ it 'should fail with one argument - match exception type' do
20
+ expect { subject.call(['foo']) }.to raise_error(expected_error)
21
+ end
22
+
23
+ it 'should fail with one argument - match exception type and message' do
24
+ expect { subject.call(['foo']) }.to raise_error(expected_error, /number of arguments/)
25
+ end
26
+
27
+ it 'should fail with one argument - match exception message' do
28
+ expect { subject.call(['foo']) }.to raise_error(/number of arguments/)
29
+ end
30
+ end
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'bad_dep_host' do
4
+ it { should_not compile.with_all_deps }
5
+ end
@@ -0,0 +1,6 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'foo.example.com' do
4
+ it { should_not include_class('sysctl::common') }
5
+ it { should contain_notify('test') }
6
+ end
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'good_dep_host' do
4
+ it { should compile.with_all_deps }
5
+ end
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'testhost' do
4
+ it { should include_class('sysctl::common') }
5
+ end
@@ -0,0 +1,6 @@
1
+ require 'rspec-puppet'
2
+
3
+ RSpec.configure do |c|
4
+ c.module_path = File.join(File.dirname(File.expand_path(__FILE__)), 'fixtures', 'modules')
5
+ c.manifest_dir = File.join(File.dirname(File.expand_path(__FILE__)), 'fixtures', 'manifests')
6
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-puppet-womble
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6.womble1
4
+ version: 0.1.6.womble2
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -35,7 +35,56 @@ executables:
35
35
  extensions: []
36
36
  extra_rdoc_files: []
37
37
  files:
38
+ - Gemfile
39
+ - LICENSE
40
+ - README.md
41
+ - Rakefile
38
42
  - bin/rspec-puppet-init
43
+ - lib/rspec-puppet.rb
44
+ - lib/rspec-puppet/errors.rb
45
+ - lib/rspec-puppet/example.rb
46
+ - lib/rspec-puppet/example/class_example_group.rb
47
+ - lib/rspec-puppet/example/define_example_group.rb
48
+ - lib/rspec-puppet/example/function_example_group.rb
49
+ - lib/rspec-puppet/example/host_example_group.rb
50
+ - lib/rspec-puppet/matchers.rb
51
+ - lib/rspec-puppet/matchers/compile.rb
52
+ - lib/rspec-puppet/matchers/count_generic.rb
53
+ - lib/rspec-puppet/matchers/create_generic.rb
54
+ - lib/rspec-puppet/matchers/dynamic_matchers.rb
55
+ - lib/rspec-puppet/matchers/include_class.rb
56
+ - lib/rspec-puppet/matchers/parameter_matcher.rb
57
+ - lib/rspec-puppet/matchers/run.rb
58
+ - lib/rspec-puppet/setup.rb
59
+ - lib/rspec-puppet/support.rb
60
+ - rspec-puppet-womble.gemspec
61
+ - spec/classes/array_spec.rb
62
+ - spec/classes/boolean_regexp_spec.rb
63
+ - spec/classes/boolean_spec.rb
64
+ - spec/classes/cycle_bad_spec.rb
65
+ - spec/classes/cycle_good_spec.rb
66
+ - spec/classes/escape_spec.rb
67
+ - spec/classes/hash_spec.rb
68
+ - spec/classes/sysctl_common_spec.rb
69
+ - spec/defines/escape_def_spec.rb
70
+ - spec/defines/sysctl_before_spec.rb
71
+ - spec/defines/sysctl_spec.rb
72
+ - spec/fixtures/manifests/site.pp
73
+ - spec/fixtures/modules/boolean/manifests/init.pp
74
+ - spec/fixtures/modules/cycle/manifests/bad.pp
75
+ - spec/fixtures/modules/cycle/manifests/good.pp
76
+ - spec/fixtures/modules/cycle/manifests/init.pp
77
+ - spec/fixtures/modules/escape/manifests/def.pp
78
+ - spec/fixtures/modules/escape/manifests/init.pp
79
+ - spec/fixtures/modules/structured_data/manifests/def.pp
80
+ - spec/fixtures/modules/structured_data/manifests/init.pp
81
+ - spec/fixtures/modules/sysctl/manifests/init.pp
82
+ - spec/functions/split_spec.rb
83
+ - spec/hosts/bad_dep_host_spec.rb
84
+ - spec/hosts/foo_spec.rb
85
+ - spec/hosts/good_dep_host_spec.rb
86
+ - spec/hosts/testhost_spec.rb
87
+ - spec/spec_helper.rb
39
88
  homepage: https://github.com/mpalmer/rspec-puppet
40
89
  licenses: []
41
90
  post_install_message: