summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/puppet/parser/functions/range.rb2
-rwxr-xr-xspec/functions/range_spec.rb7
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/puppet/parser/functions/range.rb b/lib/puppet/parser/functions/range.rb
index 06d75d4..49fba21 100644
--- a/lib/puppet/parser/functions/range.rb
+++ b/lib/puppet/parser/functions/range.rb
@@ -66,7 +66,7 @@ Will return: [0,2,4,6,8]
end
# Check whether we have integer value if so then make it so ...
- if start.match(/^\d+$/)
+ if start.to_s.match(/^\d+$/)
start = start.to_i
stop = stop.to_i
else
diff --git a/spec/functions/range_spec.rb b/spec/functions/range_spec.rb
index 9b9ece0..1446b24 100755
--- a/spec/functions/range_spec.rb
+++ b/spec/functions/range_spec.rb
@@ -67,4 +67,11 @@ describe "the range function" do
expect(scope.function_range(["00", "10"])).to eq expected
end
end
+
+ describe 'with a numeric range' do
+ it "returns a range of numbers" do
+ expected = (1..10).to_a
+ expect(scope.function_range([1,10])).to eq expected
+ end
+ end
end