puppet 2.7.18 → 2.7.19

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of puppet might be problematic. Click here for more details.

Files changed (137) hide show
  1. data/CHANGELOG +82 -0
  2. data/CONTRIBUTING.md +114 -171
  3. data/README.md +8 -0
  4. data/README_DEVELOPER.md +38 -3
  5. data/Rakefile +19 -3
  6. data/conf/osx/createpackage.sh +3 -1
  7. data/conf/redhat/logrotate +1 -1
  8. data/conf/redhat/puppet.spec +35 -8
  9. data/lib/puppet.rb +1 -1
  10. data/lib/puppet/application/agent.rb +2 -0
  11. data/lib/puppet/application/master.rb +2 -0
  12. data/lib/puppet/configurer.rb +2 -3
  13. data/lib/puppet/defaults.rb +6 -5
  14. data/lib/puppet/face/module/install.rb +2 -1
  15. data/lib/puppet/file_bucket/dipper.rb +1 -1
  16. data/lib/puppet/indirector/file_content.rb +2 -2
  17. data/lib/puppet/indirector/file_metadata.rb +2 -2
  18. data/lib/puppet/indirector/indirection.rb +3 -4
  19. data/lib/puppet/indirector/rest.rb +12 -6
  20. data/lib/puppet/interface/action_manager.rb +1 -2
  21. data/lib/puppet/module_tool/applications/unpacker.rb +22 -3
  22. data/lib/puppet/network/handler/fileserver.rb +2 -2
  23. data/lib/puppet/parser/ast/resource.rb +9 -2
  24. data/lib/puppet/parser/functions/fqdn_rand.rb +2 -1
  25. data/lib/puppet/parser/functions/md5.rb +2 -2
  26. data/lib/puppet/parser/functions/sha1.rb +2 -2
  27. data/lib/puppet/parser/functions/template.rb +0 -2
  28. data/lib/puppet/parser/type_loader.rb +1 -2
  29. data/lib/puppet/provider/augeas/augeas.rb +19 -1
  30. data/lib/puppet/provider/confine.rb +1 -1
  31. data/lib/puppet/provider/package/msi.rb +97 -51
  32. data/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +1 -0
  33. data/lib/puppet/provider/service/gentoo.rb +0 -2
  34. data/lib/puppet/provider/service/openrc.rb +69 -0
  35. data/lib/puppet/provider/service/windows.rb +6 -4
  36. data/lib/puppet/provider/user/aix.rb +8 -4
  37. data/lib/puppet/provider/user/useradd.rb +6 -0
  38. data/lib/puppet/rails/benchmark.rb +2 -2
  39. data/lib/puppet/reports/store.rb +9 -9
  40. data/lib/puppet/resource/catalog.rb +2 -1
  41. data/lib/puppet/resource/type_collection.rb +2 -1
  42. data/lib/puppet/ssl/base.rb +1 -2
  43. data/lib/puppet/ssl/certificate_authority/interface.rb +1 -0
  44. data/lib/puppet/test/test_helper.rb +2 -1
  45. data/lib/puppet/type.rb +1 -1
  46. data/lib/puppet/type/augeas.rb +1 -1
  47. data/lib/puppet/type/file.rb +4 -2
  48. data/lib/puppet/type/scheduled_task.rb +8 -10
  49. data/lib/puppet/type/tidy.rb +1 -1
  50. data/lib/puppet/util.rb +63 -25
  51. data/lib/puppet/util/autoload.rb +6 -4
  52. data/lib/puppet/util/checksums.rb +3 -8
  53. data/lib/puppet/util/diff.rb +2 -1
  54. data/lib/puppet/util/filetype.rb +1 -3
  55. data/lib/puppet/util/run_mode.rb +2 -1
  56. data/lib/puppet/util/suidmanager.rb +1 -1
  57. data/lib/puppet/util/windows.rb +1 -0
  58. data/lib/puppet/util/windows/file.rb +27 -0
  59. data/lib/puppet/util/windows/user.rb +1 -2
  60. data/man/man8/puppet-agent.8 +4 -0
  61. data/man/man8/puppet-master.8 +4 -0
  62. data/man/man8/puppetmasterd.8 +4 -0
  63. data/spec/fixtures/unit/provider/augeas/augeas/augeas/lenses/test.aug +13 -0
  64. data/spec/fixtures/unit/provider/augeas/augeas/etc/fstab +10 -0
  65. data/spec/fixtures/unit/provider/augeas/augeas/etc/hosts +6 -0
  66. data/spec/fixtures/unit/provider/augeas/augeas/etc/test +3 -0
  67. data/spec/fixtures/unit/provider/augeas/augeas/test.aug +13 -0
  68. data/spec/fixtures/unit/provider/service/openrc/rcservice_list +8 -0
  69. data/spec/fixtures/unit/provider/service/openrc/rcstatus +43 -0
  70. data/spec/integration/defaults_spec.rb +3 -3
  71. data/spec/integration/network/server/mongrel_spec.rb +8 -6
  72. data/spec/integration/parser/parser_spec.rb +1 -1
  73. data/spec/integration/type/file_spec.rb +49 -12
  74. data/spec/lib/puppet_spec/database.rb +5 -3
  75. data/spec/lib/puppet_spec/files.rb +2 -1
  76. data/spec/monkey_patches/alias_should_to_must.rb +15 -2
  77. data/spec/shared_behaviours/file_serving_model.rb +9 -6
  78. data/spec/shared_behaviours/path_parameters.rb +5 -5
  79. data/spec/shared_behaviours/things_that_declare_options.rb +5 -5
  80. data/spec/unit/application/facts_spec.rb +1 -1
  81. data/spec/unit/application_spec.rb +10 -8
  82. data/spec/unit/configurer_spec.rb +11 -2
  83. data/spec/unit/face/ca_spec.rb +15 -15
  84. data/spec/unit/face/help_spec.rb +5 -5
  85. data/spec/unit/face/module/install_spec.rb +13 -2
  86. data/spec/unit/face/node_spec.rb +7 -6
  87. data/spec/unit/indirector/certificate_request/ca_spec.rb +1 -1
  88. data/spec/unit/indirector/envelope_spec.rb +0 -13
  89. data/spec/unit/indirector/facts/inventory_service_spec.rb +1 -1
  90. data/spec/unit/indirector/queue_spec.rb +3 -3
  91. data/spec/unit/indirector/rest_spec.rb +31 -20
  92. data/spec/unit/indirector_spec.rb +5 -5
  93. data/spec/unit/interface/action_builder_spec.rb +3 -2
  94. data/spec/unit/interface/action_manager_spec.rb +1 -1
  95. data/spec/unit/interface/action_spec.rb +4 -3
  96. data/spec/unit/interface/face_collection_spec.rb +1 -1
  97. data/spec/unit/interface/option_spec.rb +13 -9
  98. data/spec/unit/interface_spec.rb +5 -5
  99. data/spec/unit/module_tool/applications/unpacker_spec.rb +61 -0
  100. data/spec/unit/network/handler/fileserver_spec.rb +3 -3
  101. data/spec/unit/other/transbucket_spec.rb +6 -9
  102. data/spec/unit/parser/ast/resource_spec.rb +27 -0
  103. data/spec/unit/parser/functions/create_resources_spec.rb +12 -12
  104. data/spec/unit/parser/lexer_spec.rb +5 -5
  105. data/spec/unit/provider/augeas/augeas_spec.rb +78 -0
  106. data/spec/unit/provider/nameservice/directoryservice_spec.rb +6 -6
  107. data/spec/unit/provider/package/freebsd_spec.rb +2 -2
  108. data/spec/unit/provider/package/msi_spec.rb +181 -114
  109. data/spec/unit/provider/package/openbsd_spec.rb +1 -0
  110. data/spec/unit/provider/package/pkgdmg_spec.rb +3 -3
  111. data/spec/unit/provider/scheduled_task/win32_taskscheduler_spec.rb +1 -1
  112. data/spec/unit/provider/service/openrc_spec.rb +209 -0
  113. data/spec/unit/provider/service/windows_spec.rb +57 -59
  114. data/spec/unit/provider/user/useradd_spec.rb +7 -0
  115. data/spec/unit/reports/store_spec.rb +13 -13
  116. data/spec/unit/resource/catalog_spec.rb +29 -24
  117. data/spec/unit/resource_spec.rb +13 -13
  118. data/spec/unit/simple_graph_spec.rb +12 -12
  119. data/spec/unit/ssl/certificate_authority/interface_spec.rb +3 -3
  120. data/spec/unit/ssl/certificate_authority_spec.rb +11 -10
  121. data/spec/unit/transaction_spec.rb +3 -3
  122. data/spec/unit/type/cron_spec.rb +171 -171
  123. data/spec/unit/type/exec_spec.rb +29 -27
  124. data/spec/unit/type/file_spec.rb +22 -13
  125. data/spec/unit/type/interface_spec.rb +1 -1
  126. data/spec/unit/type/scheduled_task_spec.rb +15 -14
  127. data/spec/unit/type/tidy_spec.rb +2 -2
  128. data/spec/unit/type/user_spec.rb +15 -15
  129. data/spec/unit/type/vlan_spec.rb +1 -1
  130. data/spec/unit/type_spec.rb +22 -25
  131. data/spec/unit/util/autoload_spec.rb +13 -7
  132. data/spec/unit/util/backups_spec.rb +36 -67
  133. data/spec/unit/util/storage_spec.rb +2 -9
  134. data/spec/unit/util/suidmanager_spec.rb +1 -1
  135. data/spec/unit/util_spec.rb +20 -28
  136. data/test/ral/manager/attributes.rb +1 -1
  137. metadata +1553 -1542
@@ -216,14 +216,14 @@ describe Puppet::Transaction do
216
216
  @transaction.eval_generate(resource)
217
217
 
218
218
  @filenames.each do |file|
219
- @transaction.catalog.resource(:file, file).should be_a(Puppet::Type.type(:file))
219
+ @transaction.catalog.resource(:file, file).must be_a(Puppet::Type.type(:file))
220
220
  end
221
221
  end
222
222
 
223
223
  it "should add a sentinel whit for the resource" do
224
224
  @transaction.eval_generate(resource)
225
225
 
226
- find_vertex(:whit, "completed_#{path}").should be_a(Puppet::Type.type(:whit))
226
+ find_vertex(:whit, "completed_#{path}").must be_a(Puppet::Type.type(:whit))
227
227
  end
228
228
 
229
229
  it "should replace dependencies on the resource with dependencies on the sentinel" do
@@ -558,7 +558,7 @@ describe Puppet::Transaction do
558
558
  transaction.add_dynamically_generated_resources
559
559
 
560
560
  generated.each do |res|
561
- res.should be_tagged(generator.tags)
561
+ res.must be_tagged(generator.tags)
562
562
  end
563
563
  end
564
564
  end
@@ -38,25 +38,25 @@ describe Puppet::Type.type(:cron), :unless => Puppet.features.microsoft_windows?
38
38
 
39
39
  describe "ensure" do
40
40
  it "should support present as a value for ensure" do
41
- proc { described_class.new(:name => 'foo', :ensure => :present) }.should_not raise_error
41
+ expect { described_class.new(:name => 'foo', :ensure => :present) }.to_not raise_error
42
42
  end
43
43
 
44
44
  it "should support absent as a value for ensure" do
45
- proc { described_class.new(:name => 'foo', :ensure => :present) }.should_not raise_error
45
+ expect { described_class.new(:name => 'foo', :ensure => :present) }.to_not raise_error
46
46
  end
47
47
 
48
48
  it "should not support other values" do
49
- proc { described_class.new(:name => 'foo', :ensure => :foo) }.should raise_error(Puppet::Error, /Invalid value/)
49
+ expect { described_class.new(:name => 'foo', :ensure => :foo) }.to raise_error(Puppet::Error, /Invalid value/)
50
50
  end
51
51
  end
52
52
 
53
53
  describe "minute" do
54
54
  it "should support absent" do
55
- proc { described_class.new(:name => 'foo', :minute => 'absent') }.should_not raise_error
55
+ expect { described_class.new(:name => 'foo', :minute => 'absent') }.to_not raise_error
56
56
  end
57
57
 
58
58
  it "should support *" do
59
- proc { described_class.new(:name => 'foo', :minute => '*') }.should_not raise_error
59
+ expect { described_class.new(:name => 'foo', :minute => '*') }.to_not raise_error
60
60
  end
61
61
 
62
62
  it "should translate absent to :absent" do
@@ -68,62 +68,62 @@ describe Puppet::Type.type(:cron), :unless => Puppet.features.microsoft_windows?
68
68
  end
69
69
 
70
70
  it "should support valid single values" do
71
- proc { described_class.new(:name => 'foo', :minute => '0') }.should_not raise_error
72
- proc { described_class.new(:name => 'foo', :minute => '1') }.should_not raise_error
73
- proc { described_class.new(:name => 'foo', :minute => '59') }.should_not raise_error
71
+ expect { described_class.new(:name => 'foo', :minute => '0') }.to_not raise_error
72
+ expect { described_class.new(:name => 'foo', :minute => '1') }.to_not raise_error
73
+ expect { described_class.new(:name => 'foo', :minute => '59') }.to_not raise_error
74
74
  end
75
75
 
76
76
  it "should not support non numeric characters" do
77
- proc { described_class.new(:name => 'foo', :minute => 'z59') }.should raise_error(Puppet::Error, /z59 is not a valid minute/)
78
- proc { described_class.new(:name => 'foo', :minute => '5z9') }.should raise_error(Puppet::Error, /5z9 is not a valid minute/)
79
- proc { described_class.new(:name => 'foo', :minute => '59z') }.should raise_error(Puppet::Error, /59z is not a valid minute/)
77
+ expect { described_class.new(:name => 'foo', :minute => 'z59') }.to raise_error(Puppet::Error, /z59 is not a valid minute/)
78
+ expect { described_class.new(:name => 'foo', :minute => '5z9') }.to raise_error(Puppet::Error, /5z9 is not a valid minute/)
79
+ expect { described_class.new(:name => 'foo', :minute => '59z') }.to raise_error(Puppet::Error, /59z is not a valid minute/)
80
80
  end
81
81
 
82
82
  it "should not support single values out of range" do
83
83
 
84
- proc { described_class.new(:name => 'foo', :minute => '-1') }.should raise_error(Puppet::Error, /-1 is not a valid minute/)
85
- proc { described_class.new(:name => 'foo', :minute => '60') }.should raise_error(Puppet::Error, /60 is not a valid minute/)
86
- proc { described_class.new(:name => 'foo', :minute => '61') }.should raise_error(Puppet::Error, /61 is not a valid minute/)
87
- proc { described_class.new(:name => 'foo', :minute => '120') }.should raise_error(Puppet::Error, /120 is not a valid minute/)
84
+ expect { described_class.new(:name => 'foo', :minute => '-1') }.to raise_error(Puppet::Error, /-1 is not a valid minute/)
85
+ expect { described_class.new(:name => 'foo', :minute => '60') }.to raise_error(Puppet::Error, /60 is not a valid minute/)
86
+ expect { described_class.new(:name => 'foo', :minute => '61') }.to raise_error(Puppet::Error, /61 is not a valid minute/)
87
+ expect { described_class.new(:name => 'foo', :minute => '120') }.to raise_error(Puppet::Error, /120 is not a valid minute/)
88
88
  end
89
89
 
90
90
  it "should support valid multiple values" do
91
- proc { described_class.new(:name => 'foo', :minute => ['0','1','59'] ) }.should_not raise_error
92
- proc { described_class.new(:name => 'foo', :minute => ['40','30','20'] ) }.should_not raise_error
93
- proc { described_class.new(:name => 'foo', :minute => ['10','30','20'] ) }.should_not raise_error
91
+ expect { described_class.new(:name => 'foo', :minute => ['0','1','59'] ) }.to_not raise_error
92
+ expect { described_class.new(:name => 'foo', :minute => ['40','30','20'] ) }.to_not raise_error
93
+ expect { described_class.new(:name => 'foo', :minute => ['10','30','20'] ) }.to_not raise_error
94
94
  end
95
95
 
96
96
  it "should not support multiple values if at least one is invalid" do
97
97
  # one invalid
98
- proc { described_class.new(:name => 'foo', :minute => ['0','1','60'] ) }.should raise_error(Puppet::Error, /60 is not a valid minute/)
99
- proc { described_class.new(:name => 'foo', :minute => ['0','120','59'] ) }.should raise_error(Puppet::Error, /120 is not a valid minute/)
100
- proc { described_class.new(:name => 'foo', :minute => ['-1','1','59'] ) }.should raise_error(Puppet::Error, /-1 is not a valid minute/)
98
+ expect { described_class.new(:name => 'foo', :minute => ['0','1','60'] ) }.to raise_error(Puppet::Error, /60 is not a valid minute/)
99
+ expect { described_class.new(:name => 'foo', :minute => ['0','120','59'] ) }.to raise_error(Puppet::Error, /120 is not a valid minute/)
100
+ expect { described_class.new(:name => 'foo', :minute => ['-1','1','59'] ) }.to raise_error(Puppet::Error, /-1 is not a valid minute/)
101
101
  # two invalid
102
- proc { described_class.new(:name => 'foo', :minute => ['0','61','62'] ) }.should raise_error(Puppet::Error, /(61|62) is not a valid minute/)
102
+ expect { described_class.new(:name => 'foo', :minute => ['0','61','62'] ) }.to raise_error(Puppet::Error, /(61|62) is not a valid minute/)
103
103
  # all invalid
104
- proc { described_class.new(:name => 'foo', :minute => ['-1','61','62'] ) }.should raise_error(Puppet::Error, /(-1|61|62) is not a valid minute/)
104
+ expect { described_class.new(:name => 'foo', :minute => ['-1','61','62'] ) }.to raise_error(Puppet::Error, /(-1|61|62) is not a valid minute/)
105
105
  end
106
106
 
107
107
  it "should support valid step syntax" do
108
- proc { described_class.new(:name => 'foo', :minute => '*/2' ) }.should_not raise_error
109
- proc { described_class.new(:name => 'foo', :minute => '10-16/2' ) }.should_not raise_error
108
+ expect { described_class.new(:name => 'foo', :minute => '*/2' ) }.to_not raise_error
109
+ expect { described_class.new(:name => 'foo', :minute => '10-16/2' ) }.to_not raise_error
110
110
  end
111
111
 
112
112
  it "should not support invalid steps" do
113
- proc { described_class.new(:name => 'foo', :minute => '*/A' ) }.should raise_error(Puppet::Error, /\*\/A is not a valid minute/)
114
- proc { described_class.new(:name => 'foo', :minute => '*/2A' ) }.should raise_error(Puppet::Error, /\*\/2A is not a valid minute/)
113
+ expect { described_class.new(:name => 'foo', :minute => '*/A' ) }.to raise_error(Puppet::Error, /\*\/A is not a valid minute/)
114
+ expect { described_class.new(:name => 'foo', :minute => '*/2A' ) }.to raise_error(Puppet::Error, /\*\/2A is not a valid minute/)
115
115
  # As it turns out cron does not complaining about steps that exceed the valid range
116
- # proc { described_class.new(:name => 'foo', :minute => '*/120' ) }.should raise_error(Puppet::Error, /is not a valid minute/)
116
+ # expect { described_class.new(:name => 'foo', :minute => '*/120' ) }.to raise_error(Puppet::Error, /is not a valid minute/)
117
117
  end
118
118
  end
119
119
 
120
120
  describe "hour" do
121
121
  it "should support absent" do
122
- proc { described_class.new(:name => 'foo', :hour => 'absent') }.should_not raise_error
122
+ expect { described_class.new(:name => 'foo', :hour => 'absent') }.to_not raise_error
123
123
  end
124
124
 
125
125
  it "should support *" do
126
- proc { described_class.new(:name => 'foo', :hour => '*') }.should_not raise_error
126
+ expect { described_class.new(:name => 'foo', :hour => '*') }.to_not raise_error
127
127
  end
128
128
 
129
129
  it "should translate absent to :absent" do
@@ -135,62 +135,62 @@ describe Puppet::Type.type(:cron), :unless => Puppet.features.microsoft_windows?
135
135
  end
136
136
 
137
137
  it "should support valid single values" do
138
- proc { described_class.new(:name => 'foo', :hour => '0') }.should_not raise_error
139
- proc { described_class.new(:name => 'foo', :hour => '11') }.should_not raise_error
140
- proc { described_class.new(:name => 'foo', :hour => '12') }.should_not raise_error
141
- proc { described_class.new(:name => 'foo', :hour => '13') }.should_not raise_error
142
- proc { described_class.new(:name => 'foo', :hour => '23') }.should_not raise_error
138
+ expect { described_class.new(:name => 'foo', :hour => '0') }.to_not raise_error
139
+ expect { described_class.new(:name => 'foo', :hour => '11') }.to_not raise_error
140
+ expect { described_class.new(:name => 'foo', :hour => '12') }.to_not raise_error
141
+ expect { described_class.new(:name => 'foo', :hour => '13') }.to_not raise_error
142
+ expect { described_class.new(:name => 'foo', :hour => '23') }.to_not raise_error
143
143
  end
144
144
 
145
145
  it "should not support non numeric characters" do
146
- proc { described_class.new(:name => 'foo', :hour => 'z15') }.should raise_error(Puppet::Error, /z15 is not a valid hour/)
147
- proc { described_class.new(:name => 'foo', :hour => '1z5') }.should raise_error(Puppet::Error, /1z5 is not a valid hour/)
148
- proc { described_class.new(:name => 'foo', :hour => '15z') }.should raise_error(Puppet::Error, /15z is not a valid hour/)
146
+ expect { described_class.new(:name => 'foo', :hour => 'z15') }.to raise_error(Puppet::Error, /z15 is not a valid hour/)
147
+ expect { described_class.new(:name => 'foo', :hour => '1z5') }.to raise_error(Puppet::Error, /1z5 is not a valid hour/)
148
+ expect { described_class.new(:name => 'foo', :hour => '15z') }.to raise_error(Puppet::Error, /15z is not a valid hour/)
149
149
  end
150
150
 
151
151
  it "should not support single values out of range" do
152
- proc { described_class.new(:name => 'foo', :hour => '-1') }.should raise_error(Puppet::Error, /-1 is not a valid hour/)
153
- proc { described_class.new(:name => 'foo', :hour => '24') }.should raise_error(Puppet::Error, /24 is not a valid hour/)
154
- proc { described_class.new(:name => 'foo', :hour => '120') }.should raise_error(Puppet::Error, /120 is not a valid hour/)
152
+ expect { described_class.new(:name => 'foo', :hour => '-1') }.to raise_error(Puppet::Error, /-1 is not a valid hour/)
153
+ expect { described_class.new(:name => 'foo', :hour => '24') }.to raise_error(Puppet::Error, /24 is not a valid hour/)
154
+ expect { described_class.new(:name => 'foo', :hour => '120') }.to raise_error(Puppet::Error, /120 is not a valid hour/)
155
155
  end
156
156
 
157
157
  it "should support valid multiple values" do
158
- proc { described_class.new(:name => 'foo', :hour => ['0','1','23'] ) }.should_not raise_error
159
- proc { described_class.new(:name => 'foo', :hour => ['5','16','14'] ) }.should_not raise_error
160
- proc { described_class.new(:name => 'foo', :hour => ['16','13','9'] ) }.should_not raise_error
158
+ expect { described_class.new(:name => 'foo', :hour => ['0','1','23'] ) }.to_not raise_error
159
+ expect { described_class.new(:name => 'foo', :hour => ['5','16','14'] ) }.to_not raise_error
160
+ expect { described_class.new(:name => 'foo', :hour => ['16','13','9'] ) }.to_not raise_error
161
161
  end
162
162
 
163
163
  it "should not support multiple values if at least one is invalid" do
164
164
  # one invalid
165
- proc { described_class.new(:name => 'foo', :hour => ['0','1','24'] ) }.should raise_error(Puppet::Error, /24 is not a valid hour/)
166
- proc { described_class.new(:name => 'foo', :hour => ['0','-1','5'] ) }.should raise_error(Puppet::Error, /-1 is not a valid hour/)
167
- proc { described_class.new(:name => 'foo', :hour => ['-1','1','23'] ) }.should raise_error(Puppet::Error, /-1 is not a valid hour/)
165
+ expect { described_class.new(:name => 'foo', :hour => ['0','1','24'] ) }.to raise_error(Puppet::Error, /24 is not a valid hour/)
166
+ expect { described_class.new(:name => 'foo', :hour => ['0','-1','5'] ) }.to raise_error(Puppet::Error, /-1 is not a valid hour/)
167
+ expect { described_class.new(:name => 'foo', :hour => ['-1','1','23'] ) }.to raise_error(Puppet::Error, /-1 is not a valid hour/)
168
168
  # two invalid
169
- proc { described_class.new(:name => 'foo', :hour => ['0','25','26'] ) }.should raise_error(Puppet::Error, /(25|26) is not a valid hour/)
169
+ expect { described_class.new(:name => 'foo', :hour => ['0','25','26'] ) }.to raise_error(Puppet::Error, /(25|26) is not a valid hour/)
170
170
  # all invalid
171
- proc { described_class.new(:name => 'foo', :hour => ['-1','24','120'] ) }.should raise_error(Puppet::Error, /(-1|24|120) is not a valid hour/)
171
+ expect { described_class.new(:name => 'foo', :hour => ['-1','24','120'] ) }.to raise_error(Puppet::Error, /(-1|24|120) is not a valid hour/)
172
172
  end
173
173
 
174
174
  it "should support valid step syntax" do
175
- proc { described_class.new(:name => 'foo', :hour => '*/2' ) }.should_not raise_error
176
- proc { described_class.new(:name => 'foo', :hour => '10-18/4' ) }.should_not raise_error
175
+ expect { described_class.new(:name => 'foo', :hour => '*/2' ) }.to_not raise_error
176
+ expect { described_class.new(:name => 'foo', :hour => '10-18/4' ) }.to_not raise_error
177
177
  end
178
178
 
179
179
  it "should not support invalid steps" do
180
- proc { described_class.new(:name => 'foo', :hour => '*/A' ) }.should raise_error(Puppet::Error, /\*\/A is not a valid hour/)
181
- proc { described_class.new(:name => 'foo', :hour => '*/2A' ) }.should raise_error(Puppet::Error, /\*\/2A is not a valid hour/)
180
+ expect { described_class.new(:name => 'foo', :hour => '*/A' ) }.to raise_error(Puppet::Error, /\*\/A is not a valid hour/)
181
+ expect { described_class.new(:name => 'foo', :hour => '*/2A' ) }.to raise_error(Puppet::Error, /\*\/2A is not a valid hour/)
182
182
  # As it turns out cron does not complaining about steps that exceed the valid range
183
- # proc { described_class.new(:name => 'foo', :hour => '*/26' ) }.should raise_error(Puppet::Error, /is not a valid hour/)
183
+ # expect { described_class.new(:name => 'foo', :hour => '*/26' ) }.to raise_error(Puppet::Error, /is not a valid hour/)
184
184
  end
185
185
  end
186
186
 
187
187
  describe "weekday" do
188
188
  it "should support absent" do
189
- proc { described_class.new(:name => 'foo', :weekday => 'absent') }.should_not raise_error
189
+ expect { described_class.new(:name => 'foo', :weekday => 'absent') }.to_not raise_error
190
190
  end
191
191
 
192
192
  it "should support *" do
193
- proc { described_class.new(:name => 'foo', :weekday => '*') }.should_not raise_error
193
+ expect { described_class.new(:name => 'foo', :weekday => '*') }.to_not raise_error
194
194
  end
195
195
 
196
196
  it "should translate absent to :absent" do
@@ -202,78 +202,78 @@ describe Puppet::Type.type(:cron), :unless => Puppet.features.microsoft_windows?
202
202
  end
203
203
 
204
204
  it "should support valid numeric weekdays" do
205
- proc { described_class.new(:name => 'foo', :weekday => '0') }.should_not raise_error
206
- proc { described_class.new(:name => 'foo', :weekday => '1') }.should_not raise_error
207
- proc { described_class.new(:name => 'foo', :weekday => '6') }.should_not raise_error
205
+ expect { described_class.new(:name => 'foo', :weekday => '0') }.to_not raise_error
206
+ expect { described_class.new(:name => 'foo', :weekday => '1') }.to_not raise_error
207
+ expect { described_class.new(:name => 'foo', :weekday => '6') }.to_not raise_error
208
208
  # According to http://www.manpagez.com/man/5/crontab 7 is also valid (Sunday)
209
- proc { described_class.new(:name => 'foo', :weekday => '7') }.should_not raise_error
209
+ expect { described_class.new(:name => 'foo', :weekday => '7') }.to_not raise_error
210
210
  end
211
211
 
212
212
  it "should support valid weekdays as words (long version)" do
213
- proc { described_class.new(:name => 'foo', :weekday => 'Monday') }.should_not raise_error
214
- proc { described_class.new(:name => 'foo', :weekday => 'Tuesday') }.should_not raise_error
215
- proc { described_class.new(:name => 'foo', :weekday => 'Wednesday') }.should_not raise_error
216
- proc { described_class.new(:name => 'foo', :weekday => 'Thursday') }.should_not raise_error
217
- proc { described_class.new(:name => 'foo', :weekday => 'Friday') }.should_not raise_error
218
- proc { described_class.new(:name => 'foo', :weekday => 'Saturday') }.should_not raise_error
219
- proc { described_class.new(:name => 'foo', :weekday => 'Sunday') }.should_not raise_error
213
+ expect { described_class.new(:name => 'foo', :weekday => 'Monday') }.to_not raise_error
214
+ expect { described_class.new(:name => 'foo', :weekday => 'Tuesday') }.to_not raise_error
215
+ expect { described_class.new(:name => 'foo', :weekday => 'Wednesday') }.to_not raise_error
216
+ expect { described_class.new(:name => 'foo', :weekday => 'Thursday') }.to_not raise_error
217
+ expect { described_class.new(:name => 'foo', :weekday => 'Friday') }.to_not raise_error
218
+ expect { described_class.new(:name => 'foo', :weekday => 'Saturday') }.to_not raise_error
219
+ expect { described_class.new(:name => 'foo', :weekday => 'Sunday') }.to_not raise_error
220
220
  end
221
221
 
222
222
  it "should support valid weekdays as words (3 character version)" do
223
- proc { described_class.new(:name => 'foo', :weekday => 'Mon') }.should_not raise_error
224
- proc { described_class.new(:name => 'foo', :weekday => 'Tue') }.should_not raise_error
225
- proc { described_class.new(:name => 'foo', :weekday => 'Wed') }.should_not raise_error
226
- proc { described_class.new(:name => 'foo', :weekday => 'Thu') }.should_not raise_error
227
- proc { described_class.new(:name => 'foo', :weekday => 'Fri') }.should_not raise_error
228
- proc { described_class.new(:name => 'foo', :weekday => 'Sat') }.should_not raise_error
229
- proc { described_class.new(:name => 'foo', :weekday => 'Sun') }.should_not raise_error
223
+ expect { described_class.new(:name => 'foo', :weekday => 'Mon') }.to_not raise_error
224
+ expect { described_class.new(:name => 'foo', :weekday => 'Tue') }.to_not raise_error
225
+ expect { described_class.new(:name => 'foo', :weekday => 'Wed') }.to_not raise_error
226
+ expect { described_class.new(:name => 'foo', :weekday => 'Thu') }.to_not raise_error
227
+ expect { described_class.new(:name => 'foo', :weekday => 'Fri') }.to_not raise_error
228
+ expect { described_class.new(:name => 'foo', :weekday => 'Sat') }.to_not raise_error
229
+ expect { described_class.new(:name => 'foo', :weekday => 'Sun') }.to_not raise_error
230
230
  end
231
231
 
232
232
  it "should not support numeric values out of range" do
233
- proc { described_class.new(:name => 'foo', :weekday => '-1') }.should raise_error(Puppet::Error, /-1 is not a valid weekday/)
234
- proc { described_class.new(:name => 'foo', :weekday => '8') }.should raise_error(Puppet::Error, /8 is not a valid weekday/)
233
+ expect { described_class.new(:name => 'foo', :weekday => '-1') }.to raise_error(Puppet::Error, /-1 is not a valid weekday/)
234
+ expect { described_class.new(:name => 'foo', :weekday => '8') }.to raise_error(Puppet::Error, /8 is not a valid weekday/)
235
235
  end
236
236
 
237
237
  it "should not support invalid weekday names" do
238
- proc { described_class.new(:name => 'foo', :weekday => 'Sar') }.should raise_error(Puppet::Error, /Sar is not a valid weekday/)
238
+ expect { described_class.new(:name => 'foo', :weekday => 'Sar') }.to raise_error(Puppet::Error, /Sar is not a valid weekday/)
239
239
  end
240
240
 
241
241
  it "should support valid multiple values" do
242
- proc { described_class.new(:name => 'foo', :weekday => ['0','1','6'] ) }.should_not raise_error
243
- proc { described_class.new(:name => 'foo', :weekday => ['Mon','Wed','Friday'] ) }.should_not raise_error
242
+ expect { described_class.new(:name => 'foo', :weekday => ['0','1','6'] ) }.to_not raise_error
243
+ expect { described_class.new(:name => 'foo', :weekday => ['Mon','Wed','Friday'] ) }.to_not raise_error
244
244
  end
245
245
 
246
246
  it "should not support multiple values if at least one is invalid" do
247
247
  # one invalid
248
- proc { described_class.new(:name => 'foo', :weekday => ['0','1','8'] ) }.should raise_error(Puppet::Error, /8 is not a valid weekday/)
249
- proc { described_class.new(:name => 'foo', :weekday => ['Mon','Fii','Sat'] ) }.should raise_error(Puppet::Error, /Fii is not a valid weekday/)
248
+ expect { described_class.new(:name => 'foo', :weekday => ['0','1','8'] ) }.to raise_error(Puppet::Error, /8 is not a valid weekday/)
249
+ expect { described_class.new(:name => 'foo', :weekday => ['Mon','Fii','Sat'] ) }.to raise_error(Puppet::Error, /Fii is not a valid weekday/)
250
250
  # two invalid
251
- proc { described_class.new(:name => 'foo', :weekday => ['Mos','Fii','Sat'] ) }.should raise_error(Puppet::Error, /(Mos|Fii) is not a valid weekday/)
251
+ expect { described_class.new(:name => 'foo', :weekday => ['Mos','Fii','Sat'] ) }.to raise_error(Puppet::Error, /(Mos|Fii) is not a valid weekday/)
252
252
  # all invalid
253
- proc { described_class.new(:name => 'foo', :weekday => ['Mos','Fii','Saa'] ) }.should raise_error(Puppet::Error, /(Mos|Fii|Saa) is not a valid weekday/)
254
- proc { described_class.new(:name => 'foo', :weekday => ['-1','8','11'] ) }.should raise_error(Puppet::Error, /(-1|8|11) is not a valid weekday/)
253
+ expect { described_class.new(:name => 'foo', :weekday => ['Mos','Fii','Saa'] ) }.to raise_error(Puppet::Error, /(Mos|Fii|Saa) is not a valid weekday/)
254
+ expect { described_class.new(:name => 'foo', :weekday => ['-1','8','11'] ) }.to raise_error(Puppet::Error, /(-1|8|11) is not a valid weekday/)
255
255
  end
256
256
 
257
257
  it "should support valid step syntax" do
258
- proc { described_class.new(:name => 'foo', :weekday => '*/2' ) }.should_not raise_error
259
- proc { described_class.new(:name => 'foo', :weekday => '0-4/2' ) }.should_not raise_error
258
+ expect { described_class.new(:name => 'foo', :weekday => '*/2' ) }.to_not raise_error
259
+ expect { described_class.new(:name => 'foo', :weekday => '0-4/2' ) }.to_not raise_error
260
260
  end
261
261
 
262
262
  it "should not support invalid steps" do
263
- proc { described_class.new(:name => 'foo', :weekday => '*/A' ) }.should raise_error(Puppet::Error, /\*\/A is not a valid weekday/)
264
- proc { described_class.new(:name => 'foo', :weekday => '*/2A' ) }.should raise_error(Puppet::Error, /\*\/2A is not a valid weekday/)
263
+ expect { described_class.new(:name => 'foo', :weekday => '*/A' ) }.to raise_error(Puppet::Error, /\*\/A is not a valid weekday/)
264
+ expect { described_class.new(:name => 'foo', :weekday => '*/2A' ) }.to raise_error(Puppet::Error, /\*\/2A is not a valid weekday/)
265
265
  # As it turns out cron does not complaining about steps that exceed the valid range
266
- # proc { described_class.new(:name => 'foo', :weekday => '*/9' ) }.should raise_error(Puppet::Error, /is not a valid weekday/)
266
+ # expect { described_class.new(:name => 'foo', :weekday => '*/9' ) }.to raise_error(Puppet::Error, /is not a valid weekday/)
267
267
  end
268
268
  end
269
269
 
270
270
  describe "month" do
271
271
  it "should support absent" do
272
- proc { described_class.new(:name => 'foo', :month => 'absent') }.should_not raise_error
272
+ expect { described_class.new(:name => 'foo', :month => 'absent') }.to_not raise_error
273
273
  end
274
274
 
275
275
  it "should support *" do
276
- proc { described_class.new(:name => 'foo', :month => '*') }.should_not raise_error
276
+ expect { described_class.new(:name => 'foo', :month => '*') }.to_not raise_error
277
277
  end
278
278
 
279
279
  it "should translate absent to :absent" do
@@ -285,95 +285,95 @@ describe Puppet::Type.type(:cron), :unless => Puppet.features.microsoft_windows?
285
285
  end
286
286
 
287
287
  it "should support valid numeric values" do
288
- proc { described_class.new(:name => 'foo', :month => '1') }.should_not raise_error
289
- proc { described_class.new(:name => 'foo', :month => '12') }.should_not raise_error
288
+ expect { described_class.new(:name => 'foo', :month => '1') }.to_not raise_error
289
+ expect { described_class.new(:name => 'foo', :month => '12') }.to_not raise_error
290
290
  end
291
291
 
292
292
  it "should support valid months as words" do
293
- proc { described_class.new(:name => 'foo', :month => 'January') }.should_not raise_error
294
- proc { described_class.new(:name => 'foo', :month => 'February') }.should_not raise_error
295
- proc { described_class.new(:name => 'foo', :month => 'March') }.should_not raise_error
296
- proc { described_class.new(:name => 'foo', :month => 'April') }.should_not raise_error
297
- proc { described_class.new(:name => 'foo', :month => 'May') }.should_not raise_error
298
- proc { described_class.new(:name => 'foo', :month => 'June') }.should_not raise_error
299
- proc { described_class.new(:name => 'foo', :month => 'July') }.should_not raise_error
300
- proc { described_class.new(:name => 'foo', :month => 'August') }.should_not raise_error
301
- proc { described_class.new(:name => 'foo', :month => 'September') }.should_not raise_error
302
- proc { described_class.new(:name => 'foo', :month => 'October') }.should_not raise_error
303
- proc { described_class.new(:name => 'foo', :month => 'November') }.should_not raise_error
304
- proc { described_class.new(:name => 'foo', :month => 'December') }.should_not raise_error
293
+ expect { described_class.new(:name => 'foo', :month => 'January') }.to_not raise_error
294
+ expect { described_class.new(:name => 'foo', :month => 'February') }.to_not raise_error
295
+ expect { described_class.new(:name => 'foo', :month => 'March') }.to_not raise_error
296
+ expect { described_class.new(:name => 'foo', :month => 'April') }.to_not raise_error
297
+ expect { described_class.new(:name => 'foo', :month => 'May') }.to_not raise_error
298
+ expect { described_class.new(:name => 'foo', :month => 'June') }.to_not raise_error
299
+ expect { described_class.new(:name => 'foo', :month => 'July') }.to_not raise_error
300
+ expect { described_class.new(:name => 'foo', :month => 'August') }.to_not raise_error
301
+ expect { described_class.new(:name => 'foo', :month => 'September') }.to_not raise_error
302
+ expect { described_class.new(:name => 'foo', :month => 'October') }.to_not raise_error
303
+ expect { described_class.new(:name => 'foo', :month => 'November') }.to_not raise_error
304
+ expect { described_class.new(:name => 'foo', :month => 'December') }.to_not raise_error
305
305
  end
306
306
 
307
307
  it "should support valid months as words (3 character short version)" do
308
- proc { described_class.new(:name => 'foo', :month => 'Jan') }.should_not raise_error
309
- proc { described_class.new(:name => 'foo', :month => 'Feb') }.should_not raise_error
310
- proc { described_class.new(:name => 'foo', :month => 'Mar') }.should_not raise_error
311
- proc { described_class.new(:name => 'foo', :month => 'Apr') }.should_not raise_error
312
- proc { described_class.new(:name => 'foo', :month => 'May') }.should_not raise_error
313
- proc { described_class.new(:name => 'foo', :month => 'Jun') }.should_not raise_error
314
- proc { described_class.new(:name => 'foo', :month => 'Jul') }.should_not raise_error
315
- proc { described_class.new(:name => 'foo', :month => 'Aug') }.should_not raise_error
316
- proc { described_class.new(:name => 'foo', :month => 'Sep') }.should_not raise_error
317
- proc { described_class.new(:name => 'foo', :month => 'Oct') }.should_not raise_error
318
- proc { described_class.new(:name => 'foo', :month => 'Nov') }.should_not raise_error
319
- proc { described_class.new(:name => 'foo', :month => 'Dec') }.should_not raise_error
308
+ expect { described_class.new(:name => 'foo', :month => 'Jan') }.to_not raise_error
309
+ expect { described_class.new(:name => 'foo', :month => 'Feb') }.to_not raise_error
310
+ expect { described_class.new(:name => 'foo', :month => 'Mar') }.to_not raise_error
311
+ expect { described_class.new(:name => 'foo', :month => 'Apr') }.to_not raise_error
312
+ expect { described_class.new(:name => 'foo', :month => 'May') }.to_not raise_error
313
+ expect { described_class.new(:name => 'foo', :month => 'Jun') }.to_not raise_error
314
+ expect { described_class.new(:name => 'foo', :month => 'Jul') }.to_not raise_error
315
+ expect { described_class.new(:name => 'foo', :month => 'Aug') }.to_not raise_error
316
+ expect { described_class.new(:name => 'foo', :month => 'Sep') }.to_not raise_error
317
+ expect { described_class.new(:name => 'foo', :month => 'Oct') }.to_not raise_error
318
+ expect { described_class.new(:name => 'foo', :month => 'Nov') }.to_not raise_error
319
+ expect { described_class.new(:name => 'foo', :month => 'Dec') }.to_not raise_error
320
320
  end
321
321
 
322
322
  it "should not support numeric values out of range" do
323
- proc { described_class.new(:name => 'foo', :month => '-1') }.should raise_error(Puppet::Error, /-1 is not a valid month/)
324
- proc { described_class.new(:name => 'foo', :month => '0') }.should raise_error(Puppet::Error, /0 is not a valid month/)
325
- proc { described_class.new(:name => 'foo', :month => '13') }.should raise_error(Puppet::Error, /13 is not a valid month/)
323
+ expect { described_class.new(:name => 'foo', :month => '-1') }.to raise_error(Puppet::Error, /-1 is not a valid month/)
324
+ expect { described_class.new(:name => 'foo', :month => '0') }.to raise_error(Puppet::Error, /0 is not a valid month/)
325
+ expect { described_class.new(:name => 'foo', :month => '13') }.to raise_error(Puppet::Error, /13 is not a valid month/)
326
326
  end
327
327
 
328
328
  it "should not support words that are not valid months" do
329
- proc { described_class.new(:name => 'foo', :month => 'Jal') }.should raise_error(Puppet::Error, /Jal is not a valid month/)
329
+ expect { described_class.new(:name => 'foo', :month => 'Jal') }.to raise_error(Puppet::Error, /Jal is not a valid month/)
330
330
  end
331
331
 
332
332
  it "should not support single values out of range" do
333
333
 
334
- proc { described_class.new(:name => 'foo', :month => '-1') }.should raise_error(Puppet::Error, /-1 is not a valid month/)
335
- proc { described_class.new(:name => 'foo', :month => '60') }.should raise_error(Puppet::Error, /60 is not a valid month/)
336
- proc { described_class.new(:name => 'foo', :month => '61') }.should raise_error(Puppet::Error, /61 is not a valid month/)
337
- proc { described_class.new(:name => 'foo', :month => '120') }.should raise_error(Puppet::Error, /120 is not a valid month/)
334
+ expect { described_class.new(:name => 'foo', :month => '-1') }.to raise_error(Puppet::Error, /-1 is not a valid month/)
335
+ expect { described_class.new(:name => 'foo', :month => '60') }.to raise_error(Puppet::Error, /60 is not a valid month/)
336
+ expect { described_class.new(:name => 'foo', :month => '61') }.to raise_error(Puppet::Error, /61 is not a valid month/)
337
+ expect { described_class.new(:name => 'foo', :month => '120') }.to raise_error(Puppet::Error, /120 is not a valid month/)
338
338
  end
339
339
 
340
340
  it "should support valid multiple values" do
341
- proc { described_class.new(:name => 'foo', :month => ['1','9','12'] ) }.should_not raise_error
342
- proc { described_class.new(:name => 'foo', :month => ['Jan','March','Jul'] ) }.should_not raise_error
341
+ expect { described_class.new(:name => 'foo', :month => ['1','9','12'] ) }.to_not raise_error
342
+ expect { described_class.new(:name => 'foo', :month => ['Jan','March','Jul'] ) }.to_not raise_error
343
343
  end
344
344
 
345
345
  it "should not support multiple values if at least one is invalid" do
346
346
  # one invalid
347
- proc { described_class.new(:name => 'foo', :month => ['0','1','12'] ) }.should raise_error(Puppet::Error, /0 is not a valid month/)
348
- proc { described_class.new(:name => 'foo', :month => ['1','13','10'] ) }.should raise_error(Puppet::Error, /13 is not a valid month/)
349
- proc { described_class.new(:name => 'foo', :month => ['Jan','Feb','Jxx'] ) }.should raise_error(Puppet::Error, /Jxx is not a valid month/)
347
+ expect { described_class.new(:name => 'foo', :month => ['0','1','12'] ) }.to raise_error(Puppet::Error, /0 is not a valid month/)
348
+ expect { described_class.new(:name => 'foo', :month => ['1','13','10'] ) }.to raise_error(Puppet::Error, /13 is not a valid month/)
349
+ expect { described_class.new(:name => 'foo', :month => ['Jan','Feb','Jxx'] ) }.to raise_error(Puppet::Error, /Jxx is not a valid month/)
350
350
  # two invalid
351
- proc { described_class.new(:name => 'foo', :month => ['Jan','Fex','Jux'] ) }.should raise_error(Puppet::Error, /(Fex|Jux) is not a valid month/)
351
+ expect { described_class.new(:name => 'foo', :month => ['Jan','Fex','Jux'] ) }.to raise_error(Puppet::Error, /(Fex|Jux) is not a valid month/)
352
352
  # all invalid
353
- proc { described_class.new(:name => 'foo', :month => ['-1','0','13'] ) }.should raise_error(Puppet::Error, /(-1|0|13) is not a valid month/)
354
- proc { described_class.new(:name => 'foo', :month => ['Jax','Fex','Aux'] ) }.should raise_error(Puppet::Error, /(Jax|Fex|Aux) is not a valid month/)
353
+ expect { described_class.new(:name => 'foo', :month => ['-1','0','13'] ) }.to raise_error(Puppet::Error, /(-1|0|13) is not a valid month/)
354
+ expect { described_class.new(:name => 'foo', :month => ['Jax','Fex','Aux'] ) }.to raise_error(Puppet::Error, /(Jax|Fex|Aux) is not a valid month/)
355
355
  end
356
356
 
357
357
  it "should support valid step syntax" do
358
- proc { described_class.new(:name => 'foo', :month => '*/2' ) }.should_not raise_error
359
- proc { described_class.new(:name => 'foo', :month => '1-12/3' ) }.should_not raise_error
358
+ expect { described_class.new(:name => 'foo', :month => '*/2' ) }.to_not raise_error
359
+ expect { described_class.new(:name => 'foo', :month => '1-12/3' ) }.to_not raise_error
360
360
  end
361
361
 
362
362
  it "should not support invalid steps" do
363
- proc { described_class.new(:name => 'foo', :month => '*/A' ) }.should raise_error(Puppet::Error, /\*\/A is not a valid month/)
364
- proc { described_class.new(:name => 'foo', :month => '*/2A' ) }.should raise_error(Puppet::Error, /\*\/2A is not a valid month/)
363
+ expect { described_class.new(:name => 'foo', :month => '*/A' ) }.to raise_error(Puppet::Error, /\*\/A is not a valid month/)
364
+ expect { described_class.new(:name => 'foo', :month => '*/2A' ) }.to raise_error(Puppet::Error, /\*\/2A is not a valid month/)
365
365
  # As it turns out cron does not complaining about steps that exceed the valid range
366
- # proc { described_class.new(:name => 'foo', :month => '*/13' ) }.should raise_error(Puppet::Error, /is not a valid month/)
366
+ # expect { described_class.new(:name => 'foo', :month => '*/13' ) }.to raise_error(Puppet::Error, /is not a valid month/)
367
367
  end
368
368
  end
369
369
 
370
370
  describe "monthday" do
371
371
  it "should support absent" do
372
- proc { described_class.new(:name => 'foo', :monthday => 'absent') }.should_not raise_error
372
+ expect { described_class.new(:name => 'foo', :monthday => 'absent') }.to_not raise_error
373
373
  end
374
374
 
375
375
  it "should support *" do
376
- proc { described_class.new(:name => 'foo', :monthday => '*') }.should_not raise_error
376
+ expect { described_class.new(:name => 'foo', :monthday => '*') }.to_not raise_error
377
377
  end
378
378
 
379
379
  it "should translate absent to :absent" do
@@ -385,76 +385,76 @@ describe Puppet::Type.type(:cron), :unless => Puppet.features.microsoft_windows?
385
385
  end
386
386
 
387
387
  it "should support valid single values" do
388
- proc { described_class.new(:name => 'foo', :monthday => '1') }.should_not raise_error
389
- proc { described_class.new(:name => 'foo', :monthday => '30') }.should_not raise_error
390
- proc { described_class.new(:name => 'foo', :monthday => '31') }.should_not raise_error
388
+ expect { described_class.new(:name => 'foo', :monthday => '1') }.to_not raise_error
389
+ expect { described_class.new(:name => 'foo', :monthday => '30') }.to_not raise_error
390
+ expect { described_class.new(:name => 'foo', :monthday => '31') }.to_not raise_error
391
391
  end
392
392
 
393
393
  it "should not support non numeric characters" do
394
- proc { described_class.new(:name => 'foo', :monthday => 'z23') }.should raise_error(Puppet::Error, /z23 is not a valid monthday/)
395
- proc { described_class.new(:name => 'foo', :monthday => '2z3') }.should raise_error(Puppet::Error, /2z3 is not a valid monthday/)
396
- proc { described_class.new(:name => 'foo', :monthday => '23z') }.should raise_error(Puppet::Error, /23z is not a valid monthday/)
394
+ expect { described_class.new(:name => 'foo', :monthday => 'z23') }.to raise_error(Puppet::Error, /z23 is not a valid monthday/)
395
+ expect { described_class.new(:name => 'foo', :monthday => '2z3') }.to raise_error(Puppet::Error, /2z3 is not a valid monthday/)
396
+ expect { described_class.new(:name => 'foo', :monthday => '23z') }.to raise_error(Puppet::Error, /23z is not a valid monthday/)
397
397
  end
398
398
 
399
399
  it "should not support single values out of range" do
400
- proc { described_class.new(:name => 'foo', :monthday => '-1') }.should raise_error(Puppet::Error, /-1 is not a valid monthday/)
401
- proc { described_class.new(:name => 'foo', :monthday => '0') }.should raise_error(Puppet::Error, /0 is not a valid monthday/)
402
- proc { described_class.new(:name => 'foo', :monthday => '32') }.should raise_error(Puppet::Error, /32 is not a valid monthday/)
400
+ expect { described_class.new(:name => 'foo', :monthday => '-1') }.to raise_error(Puppet::Error, /-1 is not a valid monthday/)
401
+ expect { described_class.new(:name => 'foo', :monthday => '0') }.to raise_error(Puppet::Error, /0 is not a valid monthday/)
402
+ expect { described_class.new(:name => 'foo', :monthday => '32') }.to raise_error(Puppet::Error, /32 is not a valid monthday/)
403
403
  end
404
404
 
405
405
  it "should support valid multiple values" do
406
- proc { described_class.new(:name => 'foo', :monthday => ['1','23','31'] ) }.should_not raise_error
407
- proc { described_class.new(:name => 'foo', :monthday => ['31','23','1'] ) }.should_not raise_error
408
- proc { described_class.new(:name => 'foo', :monthday => ['1','31','23'] ) }.should_not raise_error
406
+ expect { described_class.new(:name => 'foo', :monthday => ['1','23','31'] ) }.to_not raise_error
407
+ expect { described_class.new(:name => 'foo', :monthday => ['31','23','1'] ) }.to_not raise_error
408
+ expect { described_class.new(:name => 'foo', :monthday => ['1','31','23'] ) }.to_not raise_error
409
409
  end
410
410
 
411
411
  it "should not support multiple values if at least one is invalid" do
412
412
  # one invalid
413
- proc { described_class.new(:name => 'foo', :monthday => ['1','23','32'] ) }.should raise_error(Puppet::Error, /32 is not a valid monthday/)
414
- proc { described_class.new(:name => 'foo', :monthday => ['-1','12','23'] ) }.should raise_error(Puppet::Error, /-1 is not a valid monthday/)
415
- proc { described_class.new(:name => 'foo', :monthday => ['13','32','30'] ) }.should raise_error(Puppet::Error, /32 is not a valid monthday/)
413
+ expect { described_class.new(:name => 'foo', :monthday => ['1','23','32'] ) }.to raise_error(Puppet::Error, /32 is not a valid monthday/)
414
+ expect { described_class.new(:name => 'foo', :monthday => ['-1','12','23'] ) }.to raise_error(Puppet::Error, /-1 is not a valid monthday/)
415
+ expect { described_class.new(:name => 'foo', :monthday => ['13','32','30'] ) }.to raise_error(Puppet::Error, /32 is not a valid monthday/)
416
416
  # two invalid
417
- proc { described_class.new(:name => 'foo', :monthday => ['-1','0','23'] ) }.should raise_error(Puppet::Error, /(-1|0) is not a valid monthday/)
417
+ expect { described_class.new(:name => 'foo', :monthday => ['-1','0','23'] ) }.to raise_error(Puppet::Error, /(-1|0) is not a valid monthday/)
418
418
  # all invalid
419
- proc { described_class.new(:name => 'foo', :monthday => ['-1','0','32'] ) }.should raise_error(Puppet::Error, /(-1|0|32) is not a valid monthday/)
419
+ expect { described_class.new(:name => 'foo', :monthday => ['-1','0','32'] ) }.to raise_error(Puppet::Error, /(-1|0|32) is not a valid monthday/)
420
420
  end
421
421
 
422
422
  it "should support valid step syntax" do
423
- proc { described_class.new(:name => 'foo', :monthday => '*/2' ) }.should_not raise_error
424
- proc { described_class.new(:name => 'foo', :monthday => '10-16/2' ) }.should_not raise_error
423
+ expect { described_class.new(:name => 'foo', :monthday => '*/2' ) }.to_not raise_error
424
+ expect { described_class.new(:name => 'foo', :monthday => '10-16/2' ) }.to_not raise_error
425
425
  end
426
426
 
427
427
  it "should not support invalid steps" do
428
- proc { described_class.new(:name => 'foo', :monthday => '*/A' ) }.should raise_error(Puppet::Error, /\*\/A is not a valid monthday/)
429
- proc { described_class.new(:name => 'foo', :monthday => '*/2A' ) }.should raise_error(Puppet::Error, /\*\/2A is not a valid monthday/)
428
+ expect { described_class.new(:name => 'foo', :monthday => '*/A' ) }.to raise_error(Puppet::Error, /\*\/A is not a valid monthday/)
429
+ expect { described_class.new(:name => 'foo', :monthday => '*/2A' ) }.to raise_error(Puppet::Error, /\*\/2A is not a valid monthday/)
430
430
  # As it turns out cron does not complaining about steps that exceed the valid range
431
- # proc { described_class.new(:name => 'foo', :monthday => '*/32' ) }.should raise_error(Puppet::Error, /is not a valid monthday/)
431
+ # expect { described_class.new(:name => 'foo', :monthday => '*/32' ) }.to raise_error(Puppet::Error, /is not a valid monthday/)
432
432
  end
433
433
  end
434
434
 
435
435
  describe "environment" do
436
436
  it "it should accept an :environment that looks like a path" do
437
- lambda do
437
+ expect do
438
438
  described_class.new(:name => 'foo',:environment => 'PATH=/bin:/usr/bin:/usr/sbin')
439
- end.should_not raise_error
439
+ end.to_not raise_error
440
440
  end
441
441
 
442
442
  it "should not accept environment variables that do not contain '='" do
443
- lambda do
443
+ expect do
444
444
  described_class.new(:name => 'foo',:environment => 'INVALID')
445
- end.should raise_error(Puppet::Error, /Invalid environment setting "INVALID"/)
445
+ end.to raise_error(Puppet::Error, /Invalid environment setting "INVALID"/)
446
446
  end
447
447
 
448
448
  it "should accept empty environment variables that do not contain '='" do
449
- lambda do
449
+ expect do
450
450
  described_class.new(:name => 'foo',:environment => 'MAILTO=')
451
- end.should_not raise_error(Puppet::Error)
451
+ end.to_not raise_error(Puppet::Error)
452
452
  end
453
453
 
454
454
  it "should accept 'absent'" do
455
- lambda do
455
+ expect do
456
456
  described_class.new(:name => 'foo',:environment => 'absent')
457
- end.should_not raise_error(Puppet::Error)
457
+ end.to_not raise_error(Puppet::Error)
458
458
  end
459
459
 
460
460
  end
@@ -481,7 +481,7 @@ describe Puppet::Type.type(:cron), :unless => Puppet.features.microsoft_windows?
481
481
 
482
482
  it "should require a command when adding an entry" do
483
483
  entry = described_class.new(:name => "test_entry", :ensure => :present)
484
- expect { entry.value(:command) }.should raise_error(Puppet::Error, /No command/)
484
+ expect { entry.value(:command) }.to raise_error(Puppet::Error, /No command/)
485
485
  end
486
486
 
487
487
  it "should not require a command when removing an entry" do