puppet 3.7.3 → 3.7.4

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 (57) hide show
  1. data/Gemfile +4 -0
  2. data/ext/build_defaults.yaml +2 -2
  3. data/ext/project_data.yaml +2 -2
  4. data/lib/puppet.rb +1 -1
  5. data/lib/puppet/configurer.rb +7 -4
  6. data/lib/puppet/environments.rb +68 -51
  7. data/lib/puppet/functions/scanf.rb +46 -0
  8. data/lib/puppet/network/http/webrick/rest.rb +3 -0
  9. data/lib/puppet/parser/ast/pops_bridge.rb +2 -1
  10. data/lib/puppet/parser/compiler.rb +11 -3
  11. data/lib/puppet/parser/functions/realize.rb +7 -2
  12. data/lib/puppet/parser/functions/scanf.rb +35 -0
  13. data/lib/puppet/parser/relationship.rb +21 -6
  14. data/lib/puppet/parser/resource.rb +11 -4
  15. data/lib/puppet/pops.rb +7 -0
  16. data/lib/puppet/pops/evaluator/access_operator.rb +1 -6
  17. data/lib/puppet/pops/evaluator/collector_transformer.rb +219 -0
  18. data/lib/puppet/pops/evaluator/collectors/abstract_collector.rb +86 -0
  19. data/lib/puppet/pops/evaluator/collectors/catalog_collector.rb +25 -0
  20. data/lib/puppet/pops/evaluator/collectors/exported_collector.rb +66 -0
  21. data/lib/puppet/pops/evaluator/collectors/fixed_set_collector.rb +37 -0
  22. data/lib/puppet/pops/evaluator/compare_operator.rb +8 -28
  23. data/lib/puppet/pops/evaluator/evaluator_impl.rb +4 -18
  24. data/lib/puppet/pops/evaluator/relationship_operator.rb +4 -0
  25. data/lib/puppet/pops/evaluator/runtime3_support.rb +2 -2
  26. data/lib/puppet/pops/parser/egrammar.ra +3 -3
  27. data/lib/puppet/pops/parser/eparser.rb +3 -3
  28. data/lib/puppet/pops/parser/evaluating_parser.rb +4 -0
  29. data/lib/puppet/pops/types/type_calculator.rb +19 -8
  30. data/lib/puppet/pops/types/type_parser.rb +1 -4
  31. data/lib/puppet/provider/service/redhat.rb +6 -3
  32. data/lib/puppet/resource/catalog.rb +12 -1
  33. data/lib/puppet/settings/environment_conf.rb +7 -8
  34. data/lib/puppet/type/cron.rb +5 -1
  35. data/lib/puppet/type/file/content.rb +1 -1
  36. data/lib/puppet/util/tagging.rb +21 -2
  37. data/lib/puppet/version.rb +1 -1
  38. data/spec/integration/indirector/catalog/compiler_spec.rb +11 -0
  39. data/spec/integration/parser/collector_spec.rb +41 -0
  40. data/spec/integration/parser/compiler_spec.rb +16 -0
  41. data/spec/integration/parser/future_compiler_spec.rb +1 -1
  42. data/spec/unit/environments_spec.rb +238 -118
  43. data/spec/unit/functions/scanf_spec.rb +36 -0
  44. data/spec/unit/network/http/rack/rest_spec.rb +11 -8
  45. data/spec/unit/network/http/webrick/rest_spec.rb +19 -0
  46. data/spec/unit/parser/compiler_spec.rb +0 -27
  47. data/spec/unit/pops/evaluator/access_ops_spec.rb +9 -9
  48. data/spec/unit/pops/evaluator/comparison_ops_spec.rb +14 -8
  49. data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +20 -8
  50. data/spec/unit/pops/parser/parse_basic_expressions_spec.rb +10 -0
  51. data/spec/unit/pops/parser/parse_heredoc_spec.rb +30 -0
  52. data/spec/unit/pops/types/type_calculator_spec.rb +18 -0
  53. data/spec/unit/pops/types/type_parser_spec.rb +2 -2
  54. data/spec/unit/provider/service/redhat_spec.rb +2 -1
  55. data/spec/unit/type/cron_spec.rb +24 -24
  56. data/spec/unit/util/tagging_spec.rb +7 -0
  57. metadata +11 -2
@@ -0,0 +1,36 @@
1
+ require 'spec_helper'
2
+
3
+ require 'puppet_spec/compiler'
4
+ require 'matchers/resource'
5
+
6
+ describe 'the scanf function' do
7
+ include PuppetSpec::Compiler
8
+ include Matchers::Resource
9
+
10
+ before :each do
11
+ Puppet[:parser] = 'future'
12
+ end
13
+
14
+ it 'scans a value and returns an array' do
15
+ expect(compile_to_catalog("$x = '42'.scanf('%i')[0] + 1; notify { \"test$x\": }")).to have_resource('Notify[test43]')
16
+ end
17
+
18
+ it 'scans a value and returns result of a code block' do
19
+ expect(compile_to_catalog("$x = '42'.scanf('%i')|$x|{$x[0]} + 1; notify { \"test$x\": }")).to have_resource('Notify[test43]')
20
+ end
21
+
22
+ it 'returns empty array if nothing was scanned' do
23
+ expect(compile_to_catalog("$x = 'no'.scanf('%i')[0]; notify { \"test${x}test\": }")).to have_resource('Notify[testtest]')
24
+ end
25
+
26
+ it 'produces result up to first unsuccessful scan' do
27
+ expect(compile_to_catalog("$x = '42 no'.scanf('%i'); notify { \"test${x[0]}${x[1]}test\": }")).to have_resource('Notify[test42test]')
28
+ end
29
+
30
+
31
+ it 'errors when not given enough arguments' do
32
+ expect do
33
+ compile_to_catalog("'42'.scanf()")
34
+ end.to raise_error(/.*expected.*scanf\(String data, String format, Callable block \{0,1\}\)/m)
35
+ end
36
+ end
@@ -25,14 +25,17 @@ describe "Puppet::Network::HTTP::RackREST", :if => Puppet.features.rack? do
25
25
  end
26
26
 
27
27
  let(:minimal_certificate) do
28
- cert = OpenSSL::X509::Certificate.new
29
- cert.version = 2
30
- cert.serial = 0
31
- cert.not_before = Time.now
32
- cert.not_after = Time.now + 3600
33
- cert.public_key = OpenSSL::PKey::RSA.new(512)
34
- cert.subject = OpenSSL::X509::Name.parse("/CN=testing")
35
- cert
28
+ key = OpenSSL::PKey::RSA.new(512)
29
+ signer = Puppet::SSL::CertificateSigner.new
30
+ cert = OpenSSL::X509::Certificate.new
31
+ cert.version = 2
32
+ cert.serial = 0
33
+ cert.not_before = Time.now
34
+ cert.not_after = Time.now + 3600
35
+ cert.public_key = key
36
+ cert.subject = OpenSSL::X509::Name.parse("/CN=testing")
37
+ signer.sign(cert, key)
38
+ cert
36
39
  end
37
40
 
38
41
  describe "#headers" do
@@ -62,6 +62,7 @@ describe Puppet::Network::HTTP::WEBrickREST do
62
62
  it "should set the status and body on the response when setting the response for a successful query" do
63
63
  @response.expects(:status=).with 200
64
64
  @response.expects(:body=).with "mybody"
65
+ @response.expects(:[]=).with('connection', 'close') if RUBY_VERSION[0,3] == '1.8'
65
66
 
66
67
  @handler.set_response(@response, "mybody", 200)
67
68
  end
@@ -74,6 +75,7 @@ describe Puppet::Network::HTTP::WEBrickREST do
74
75
  @response.expects(:[]=).with('content-length', 100)
75
76
  @response.expects(:status=).with 200
76
77
  @response.expects(:body=).with @file
78
+ @response.expects(:[]=).with('connection', 'close') if RUBY_VERSION[0,3] == '1.8'
77
79
 
78
80
  @handler.set_response(@response, @file, 200)
79
81
  end
@@ -81,9 +83,26 @@ describe Puppet::Network::HTTP::WEBrickREST do
81
83
  it "should set the status and message on the response when setting the response for a failed query" do
82
84
  @response.expects(:status=).with 400
83
85
  @response.expects(:body=).with "mybody"
86
+ @response.expects(:[]=).with('connection', 'close') if RUBY_VERSION[0,3] == '1.8'
84
87
 
85
88
  @handler.set_response(@response, "mybody", 400)
86
89
  end
90
+
91
+ it "omits the 'Connection: close' header on ruby 1.9 and up", :if => RUBY_VERSION[0,3] != '1.8' do
92
+ @response.expects(:status=).with 200
93
+ @response.expects(:body=).with "mybody"
94
+ @response.expects(:[]=).with('connection', 'close').never
95
+
96
+ @handler.set_response(@response, "mybody", 200)
97
+ end
98
+
99
+ it "closes the connection on ruby 1.8", :if => RUBY_VERSION[0,3] == '1.8' do
100
+ @response.expects(:status=).with 200
101
+ @response.expects(:body=).with "mybody"
102
+ @response.expects(:[]=).with('connection', 'close')
103
+
104
+ @handler.set_response(@response, "mybody", 200)
105
+ end
87
106
  end
88
107
 
89
108
  describe "and determining the request parameters" do
@@ -78,17 +78,6 @@ describe Puppet::Parser::Compiler do
78
78
  @scope.resource = @scope_resource
79
79
  end
80
80
 
81
- it "should have a class method that compiles, converts, and returns a catalog" do
82
- compiler = stub 'compiler'
83
- Puppet::Parser::Compiler.expects(:new).with(@node).returns compiler
84
- catalog = stub 'catalog'
85
- compiler.expects(:compile).returns catalog
86
- converted_catalog = stub 'converted_catalog'
87
- catalog.expects(:to_resource).returns converted_catalog
88
-
89
- Puppet::Parser::Compiler.compile(@node).should equal(converted_catalog)
90
- end
91
-
92
81
  it "should fail intelligently when a class-level compile fails" do
93
82
  Puppet::Parser::Compiler.expects(:new).raises ArgumentError
94
83
  lambda { Puppet::Parser::Compiler.compile(@node) }.should raise_error(Puppet::Error)
@@ -117,22 +106,6 @@ describe Puppet::Parser::Compiler do
117
106
  @compiler.classlist.sort.should == %w{one two}.sort
118
107
  end
119
108
 
120
- it "should clear the global caches before compile" do
121
- compiler = stub 'compiler'
122
- Puppet::Parser::Compiler.expects(:new).with(@node).returns compiler
123
- catalog = stub 'catalog'
124
- compiler.expects(:compile).returns catalog
125
- catalog.expects(:to_resource)
126
-
127
- $known_resource_types = "rspec"
128
- $env_module_directories = "rspec"
129
-
130
- Puppet::Parser::Compiler.compile(@node)
131
-
132
- $known_resource_types = nil
133
- $env_module_directories = nil
134
- end
135
-
136
109
  describe "when initializing" do
137
110
 
138
111
  it "should set its node attribute" do
@@ -166,23 +166,23 @@ describe 'Puppet::Pops::Evaluator::EvaluatorImpl/AccessOperator' do
166
166
 
167
167
  # Hash Type
168
168
  #
169
- it 'produces a Hash[Scalar,String] from the expression Hash[String]' do
170
- expr = fqr('Hash')[fqr('String')]
169
+ it 'produces a Hash[Scalar,String] from the expression Hash[Scalar, String]' do
170
+ expr = fqr('Hash')[fqr('Scalar'), fqr('String')]
171
171
  expect(evaluate(expr)).to be_the_type(types.hash_of(types.string, types.scalar))
172
172
 
173
173
  # arguments are flattened
174
- expr = fqr('Hash')[[fqr('String')]]
174
+ expr = fqr('Hash')[[fqr('Scalar'), fqr('String')]]
175
175
  expect(evaluate(expr)).to be_the_type(types.hash_of(types.string, types.scalar))
176
176
  end
177
177
 
178
- it 'produces a Hash[String,String] from the expression Hash[String, String]' do
179
- expr = fqr('Hash')[fqr('String'), fqr('String')]
180
- expect(evaluate(expr)).to be_the_type(types.hash_of(types.string, types.string))
178
+ it 'gives an error if only one type is specified ' do
179
+ expr = fqr('Hash')[fqr('String')]
180
+ expect {evaluate(expr)}.to raise_error(/accepts 2 to 4 arguments/)
181
181
  end
182
182
 
183
- it 'produces a Hash[Scalar,String] from the expression Hash[Integer][String]' do
184
- expr = fqr('Hash')[fqr('Integer')][fqr('String')]
185
- expect(evaluate(expr)).to be_the_type(types.hash_of(types.string, types.scalar))
183
+ it 'produces a Hash[Scalar,String] from the expression Hash[Integer, Array][Integer, String]' do
184
+ expr = fqr('Hash')[fqr('Integer'), fqr('Array')][fqr('Integer'), fqr('String')]
185
+ expect(evaluate(expr)).to be_the_type(types.hash_of(types.string, types.integer))
186
186
  end
187
187
 
188
188
  it "gives an error if parameter is not a type" do
@@ -71,17 +71,23 @@ describe 'Puppet::Pops::Evaluator::EvaluatorImpl' do
71
71
  context "of mixed value types" do
72
72
  it "1 == 1.0 == true" do; evaluate(literal(1) == literal(1.0)).should == true ; end
73
73
  it "1 < 1.1 == true" do; evaluate(literal(1) < literal(1.1)).should == true ; end
74
- it "'1' < 1.1 == true" do; evaluate(literal('1') < literal(1.1)).should == true ; end
75
74
  it "1.0 == 1 == true" do; evaluate(literal(1.0) == literal(1)).should == true ; end
76
75
  it "1.0 < 2 == true" do; evaluate(literal(1.0) < literal(2)).should == true ; end
77
- it "'1.0' < 1.1 == true" do; evaluate(literal('1.0') < literal(1.1)).should == true ; end
78
-
79
76
  it "'1.0' < 'a' == true" do; evaluate(literal('1.0') < literal('a')).should == true ; end
80
- it "'1.0' < '' == true" do; evaluate(literal('1.0') < literal('')).should == true ; end
81
- it "'1.0' < ' ' == true" do; evaluate(literal('1.0') < literal(' ')).should == true ; end
77
+ it "'1.0' < '' == true" do; evaluate(literal('1.0') < literal('')).should == false ; end
78
+ it "'1.0' < ' ' == true" do; evaluate(literal('1.0') < literal(' ')).should == false ; end
82
79
  it "'a' > '1.0' == true" do; evaluate(literal('a') > literal('1.0')).should == true ; end
83
80
  end
84
81
 
82
+ context "of unsupported mixed value types" do
83
+ it "'1' < 1.1 == true" do
84
+ expect{ evaluate(literal('1') < literal(1.1))}.to raise_error(/String < Float/)
85
+ end
86
+ it "'1.0' < 1.1 == true" do
87
+ expect{evaluate(literal('1.0') < literal(1.1))}.to raise_error(/String < Float/)
88
+ end
89
+ end
90
+
85
91
  context "of regular expressions" do
86
92
  it "/.*/ == /.*/ == true" do; evaluate(literal(/.*/) == literal(/.*/)).should == true ; end
87
93
  it "/.*/ != /a.*/ == true" do; evaluate(literal(/.*/).ne(literal(/a.*/))).should == true ; end
@@ -235,9 +241,9 @@ describe 'Puppet::Pops::Evaluator::EvaluatorImpl' do
235
241
  evaluate(literal(15).in(literal([1,0xf,2]))).should == true
236
242
  end
237
243
 
238
- it "should find numbers as strings" do
239
- evaluate(literal(15).in(literal([1, '0xf',2]))).should == true
240
- evaluate(literal('15').in(literal([1, 0xf,2]))).should == true
244
+ it "should not find numbers as strings" do
245
+ evaluate(literal(15).in(literal([1, '0xf',2]))).should == false
246
+ evaluate(literal('15').in(literal([1, 0xf,2]))).should == false
241
247
  end
242
248
 
243
249
  it "should not find numbers embedded in strings, nor digits in numbers" do
@@ -190,14 +190,11 @@ describe 'Puppet::Pops::Evaluator::EvaluatorImpl' do
190
190
  "2 >= 1" => true,
191
191
  "1 == 1.0 " => true,
192
192
  "1 < 1.1 " => true,
193
- "'1' < 1.1" => true,
194
193
  "1.0 == 1 " => true,
195
194
  "1.0 < 2 " => true,
196
- "1.0 < 'a'" => true,
197
- "'1.0' < 1.1" => true,
198
195
  "'1.0' < 'a'" => true,
199
- "'1.0' < '' " => true,
200
- "'1.0' < ' '" => true,
196
+ "'1.0' < '' " => false,
197
+ "'1.0' < ' '" => false,
201
198
  "'a' > '1.0'" => true,
202
199
  "/.*/ == /.*/ " => true,
203
200
  "/.*/ != /a.*/" => true,
@@ -210,6 +207,21 @@ describe 'Puppet::Pops::Evaluator::EvaluatorImpl' do
210
207
  end
211
208
  end
212
209
 
210
+ {
211
+ "a > 1" => /String > Integer/,
212
+ "a >= 1" => /String >= Integer/,
213
+ "a < 1" => /String < Integer/,
214
+ "a <= 1" => /String <= Integer/,
215
+ "1 > a" => /Integer > String/,
216
+ "1 >= a" => /Integer >= String/,
217
+ "1 < a" => /Integer < String/,
218
+ "1 <= a" => /Integer <= String/,
219
+ }.each do | source, error|
220
+ it "should not allow comparison of String and Number '#{source}'" do
221
+ expect { parser.evaluate_string(scope, source, __FILE__)}.to raise_error(error)
222
+ end
223
+ end
224
+
213
225
  {
214
226
  "'a' =~ /.*/" => true,
215
227
  "'a' =~ '.*'" => true,
@@ -271,8 +283,8 @@ describe 'Puppet::Pops::Evaluator::EvaluatorImpl' do
271
283
  "/xxx/ in {'aaaxxxbbb'=>1}" => true,
272
284
  "/yyy/ in {'aaaxxxbbb'=>1}" => false,
273
285
  "15 in [1, 0xf]" => true,
274
- "15 in [1, '0xf']" => true,
275
- "'15' in [1, 0xf]" => true,
286
+ "15 in [1, '0xf']" => false,
287
+ "'15' in [1, 0xf]" => false,
276
288
  "15 in [1, 115]" => false,
277
289
  "1 in [11, '111']" => false,
278
290
  "'1' in [11, '111']" => false,
@@ -676,7 +688,7 @@ describe 'Puppet::Pops::Evaluator::EvaluatorImpl' do
676
688
  "Hash[Integer, 0]" => 'Hash-Type[] arguments must be types. Got Fixnum',
677
689
  "Array[Integer,1,2,3]" => 'Array-Type[] accepts 1 to 3 arguments. Got 4',
678
690
  "Array[Integer,String]" => "A Type's size constraint arguments must be a single Integer type, or 1-2 integers (or default). Got a String-Type",
679
- "Hash[Integer,String, 1,2,3]" => 'Hash-Type[] accepts 1 to 4 arguments. Got 5',
691
+ "Hash[Integer,String, 1,2,3]" => 'Hash-Type[] accepts 2 to 4 arguments. Got 5',
680
692
  "'abc'[x]" => "The value 'x' cannot be converted to Numeric",
681
693
  "'abc'[1.0]" => "A String[] cannot use Float where Integer is expected",
682
694
  "'abc'[1,2,3]" => "String supports [] with one or two arguments. Got 3",
@@ -163,6 +163,11 @@ describe "egrammar parsing basic expressions" do
163
163
  it "$a [1,2,3] == [1,2,3]" do
164
164
  dump(parse("$a = [1,2,3] == [1,2,3]")).should == "(= $a (== ([] 1 2 3) ([] 1 2 3)))"
165
165
  end
166
+
167
+ it "calculates the text length of an empty array" do
168
+ expect(parse("[]").current.body.length).to eq(2)
169
+ expect(parse("[ ]").current.body.length).to eq(3)
170
+ end
166
171
  end
167
172
 
168
173
  context "When parsing indexed access" do
@@ -221,6 +226,11 @@ describe "egrammar parsing basic expressions" do
221
226
  it "$a = {'a'=> 1, 'b'=>2} != {'x'=> 1, 'y'=>3}" do
222
227
  dump(parse("$a = {'a'=>1,'b'=>2} != {'a'=>1,'b'=>2}")).should == "(= $a (!= ({} ('a' 1) ('b' 2)) ({} ('a' 1) ('b' 2))))"
223
228
  end
229
+
230
+ it "calculates the text length of an empty hash" do
231
+ expect(parse("{}").current.body.length).to eq(2)
232
+ expect(parse("{ }").current.body.length).to eq(3)
233
+ end
224
234
  end
225
235
 
226
236
  context "When parsing the 'in' operator" do
@@ -71,6 +71,36 @@ describe "egrammar parsing heredoc" do
71
71
  ].join("\n")
72
72
  end
73
73
 
74
+ it "parses with escaped newlines without preceding whitespace" do
75
+ src = <<-CODE
76
+ @(END/L)
77
+ First Line\\
78
+ Second Line
79
+ |- END
80
+ CODE
81
+ parse(src)
82
+ dump(parse(src)).should == [
83
+ "(@()",
84
+ " (sublocated 'First Line Second Line')",
85
+ ")"
86
+ ].join("\n")
87
+ end
88
+
89
+ it "parses with escaped newlines with proper margin" do
90
+ src = <<-CODE
91
+ @(END/L)
92
+ First Line\\
93
+ Second Line
94
+ |- END
95
+ CODE
96
+ parse(src)
97
+ dump(parse(src)).should == [
98
+ "(@()",
99
+ " (sublocated ' First Line Second Line')",
100
+ ")"
101
+ ].join("\n")
102
+ end
103
+
74
104
  it "parses interpolated heredoc expression with false start on $" do
75
105
  src = <<-CODE
76
106
  @("END")
@@ -568,6 +568,24 @@ describe 'The type calculator' do
568
568
  end
569
569
  end
570
570
 
571
+ context 'for Variant, such that' do
572
+ it 'it is assignable to a type if all contained types are assignable to that type' do
573
+ v = variant_t(range_t(10, 12),range_t(14, 20))
574
+ v.should be_assignable_to(integer_t)
575
+ v.should be_assignable_to(range_t(10, 20))
576
+
577
+ # test that both types are assignable to one of the variants OK
578
+ v.should be_assignable_to(variant_t(range_t(10, 20), range_t(30, 40)))
579
+
580
+ # test where each type is assignable to different types in a variant is OK
581
+ v.should be_assignable_to(variant_t(range_t(10, 13), range_t(14, 40)))
582
+
583
+ # not acceptable
584
+ v.should_not be_assignable_to(range_t(0, 4))
585
+ v.should_not be_assignable_to(string_t)
586
+ end
587
+ end
588
+
571
589
  context "for Scalar, such that" do
572
590
  it "all scalars are assignable to Scalar" do
573
591
  t = Puppet::Pops::Types::PScalarType.new()
@@ -63,7 +63,7 @@ describe Puppet::Pops::Types::TypeParser do
63
63
  end
64
64
 
65
65
  it "interprets a parameterized Hash[t] as a Hash of Scalar to t" do
66
- expect(parser.parse("Hash[Integer]")).to be_the_type(types.hash_of(types.integer))
66
+ expect(parser.parse("Hash[Scalar, Integer]")).to be_the_type(types.hash_of(types.integer))
67
67
  end
68
68
 
69
69
  it "parses a parameterized type into the type object" do
@@ -129,7 +129,7 @@ describe Puppet::Pops::Types::TypeParser do
129
129
 
130
130
  it "rejects an collection spec with the wrong number of parameters" do
131
131
  expect { parser.parse("Array[Integer, 1,2,3]") }.to raise_the_parameter_error("Array", "1 to 3", 4)
132
- expect { parser.parse("Hash[Integer, Integer, 1,2,3]") }.to raise_the_parameter_error("Hash", "1 to 4", 5)
132
+ expect { parser.parse("Hash[Integer, Integer, 1,2,3]") }.to raise_the_parameter_error("Hash", "2 to 4", 5)
133
133
  end
134
134
 
135
135
  it "interprets anything that is not a built in type to be a resource type" do
@@ -55,7 +55,8 @@ describe provider_class, :as_platform => :posix do
55
55
  end
56
56
  end
57
57
 
58
- it "(#15797) should use 'on' when calling enable" do
58
+ it "should use '--add' and 'on' when calling enable" do
59
+ provider_class.expects(:chkconfig).with("--add", @resource[:name])
59
60
  provider_class.expects(:chkconfig).with(@resource[:name], :on)
60
61
  @provider.enable
61
62
  end
@@ -307,33 +307,33 @@ describe Puppet::Type.type(:cron), :unless => Puppet.features.microsoft_windows?
307
307
  end
308
308
 
309
309
  it "should support valid months as words" do
310
- expect { described_class.new(:name => 'foo', :month => 'January') }.to_not raise_error
311
- expect { described_class.new(:name => 'foo', :month => 'February') }.to_not raise_error
312
- expect { described_class.new(:name => 'foo', :month => 'March') }.to_not raise_error
313
- expect { described_class.new(:name => 'foo', :month => 'April') }.to_not raise_error
314
- expect { described_class.new(:name => 'foo', :month => 'May') }.to_not raise_error
315
- expect { described_class.new(:name => 'foo', :month => 'June') }.to_not raise_error
316
- expect { described_class.new(:name => 'foo', :month => 'July') }.to_not raise_error
317
- expect { described_class.new(:name => 'foo', :month => 'August') }.to_not raise_error
318
- expect { described_class.new(:name => 'foo', :month => 'September') }.to_not raise_error
319
- expect { described_class.new(:name => 'foo', :month => 'October') }.to_not raise_error
320
- expect { described_class.new(:name => 'foo', :month => 'November') }.to_not raise_error
321
- expect { described_class.new(:name => 'foo', :month => 'December') }.to_not raise_error
310
+ expect( described_class.new(:name => 'foo', :month => 'January')[:month] ).to eq(['1'])
311
+ expect( described_class.new(:name => 'foo', :month => 'February')[:month] ).to eq(['2'])
312
+ expect( described_class.new(:name => 'foo', :month => 'March')[:month] ).to eq(['3'])
313
+ expect( described_class.new(:name => 'foo', :month => 'April')[:month] ).to eq(['4'])
314
+ expect( described_class.new(:name => 'foo', :month => 'May')[:month] ).to eq(['5'])
315
+ expect( described_class.new(:name => 'foo', :month => 'June')[:month] ).to eq(['6'])
316
+ expect( described_class.new(:name => 'foo', :month => 'July')[:month] ).to eq(['7'])
317
+ expect( described_class.new(:name => 'foo', :month => 'August')[:month] ).to eq(['8'])
318
+ expect( described_class.new(:name => 'foo', :month => 'September')[:month] ).to eq(['9'])
319
+ expect( described_class.new(:name => 'foo', :month => 'October')[:month] ).to eq(['10'])
320
+ expect( described_class.new(:name => 'foo', :month => 'November')[:month] ).to eq(['11'])
321
+ expect( described_class.new(:name => 'foo', :month => 'December')[:month] ).to eq(['12'])
322
322
  end
323
323
 
324
324
  it "should support valid months as words (3 character short version)" do
325
- expect { described_class.new(:name => 'foo', :month => 'Jan') }.to_not raise_error
326
- expect { described_class.new(:name => 'foo', :month => 'Feb') }.to_not raise_error
327
- expect { described_class.new(:name => 'foo', :month => 'Mar') }.to_not raise_error
328
- expect { described_class.new(:name => 'foo', :month => 'Apr') }.to_not raise_error
329
- expect { described_class.new(:name => 'foo', :month => 'May') }.to_not raise_error
330
- expect { described_class.new(:name => 'foo', :month => 'Jun') }.to_not raise_error
331
- expect { described_class.new(:name => 'foo', :month => 'Jul') }.to_not raise_error
332
- expect { described_class.new(:name => 'foo', :month => 'Aug') }.to_not raise_error
333
- expect { described_class.new(:name => 'foo', :month => 'Sep') }.to_not raise_error
334
- expect { described_class.new(:name => 'foo', :month => 'Oct') }.to_not raise_error
335
- expect { described_class.new(:name => 'foo', :month => 'Nov') }.to_not raise_error
336
- expect { described_class.new(:name => 'foo', :month => 'Dec') }.to_not raise_error
325
+ expect( described_class.new(:name => 'foo', :month => 'Jan')[:month] ).to eq(['1'])
326
+ expect( described_class.new(:name => 'foo', :month => 'Feb')[:month] ).to eq(['2'])
327
+ expect( described_class.new(:name => 'foo', :month => 'Mar')[:month] ).to eq(['3'])
328
+ expect( described_class.new(:name => 'foo', :month => 'Apr')[:month] ).to eq(['4'])
329
+ expect( described_class.new(:name => 'foo', :month => 'May')[:month] ).to eq(['5'])
330
+ expect( described_class.new(:name => 'foo', :month => 'Jun')[:month] ).to eq(['6'])
331
+ expect( described_class.new(:name => 'foo', :month => 'Jul')[:month] ).to eq(['7'])
332
+ expect( described_class.new(:name => 'foo', :month => 'Aug')[:month] ).to eq(['8'])
333
+ expect( described_class.new(:name => 'foo', :month => 'Sep')[:month] ).to eq(['9'])
334
+ expect( described_class.new(:name => 'foo', :month => 'Oct')[:month] ).to eq(['10'])
335
+ expect( described_class.new(:name => 'foo', :month => 'Nov')[:month] ).to eq(['11'])
336
+ expect( described_class.new(:name => 'foo', :month => 'Dec')[:month] ).to eq(['12'])
337
337
  end
338
338
 
339
339
  it "should not support numeric values out of range" do