]> gitweb.fluxo.info Git - puppet-stdlib.git/commitdiff
Add range tests for numeric with step and mixed arguments
authorErik Dalén <dalen@spotify.com>
Wed, 12 Nov 2014 15:52:36 +0000 (16:52 +0100)
committerErik Dalén <dalen@spotify.com>
Wed, 12 Nov 2014 15:52:36 +0000 (16:52 +0100)
spec/functions/range_spec.rb

index 1446b245cd5f6f9497ac52e18f86227d7c237039..ef86f97199e728443d89dd36d38b7ab1ea192786 100755 (executable)
@@ -73,5 +73,14 @@ describe "the range function" do
       expected = (1..10).to_a
       expect(scope.function_range([1,10])).to eq expected
     end
+    it "returns a range of numbers with step parameter" do
+      expected = (1..10).step(2).to_a
+      expect(scope.function_range([1,10,2])).to eq expected
+    end
+    it "works with mixed numeric like strings and numeric arguments" do
+      expected = (1..10).to_a
+      expect(scope.function_range(['1',10])).to eq expected
+      expect(scope.function_range([1,'10'])).to eq expected
+    end
   end
 end