summaryrefslogtreecommitdiffstats
path: root/spec/unit/parser/functions/versioncmp_spec.rb
diff options
context:
space:
mode:
authorMarkus Roberts <Markus@reality.com>2010-06-28 17:10:20 -0700
committerMarkus Roberts <Markus@reality.com>2010-06-28 17:10:20 -0700
commitfdc8c3509b5ac5bc170c54d72b2c2bafb58409f2 (patch)
tree6ed2204d72c6924e867a1320d3b7e6728035f1a1 /spec/unit/parser/functions/versioncmp_spec.rb
parent9a94ee274c39c261cd49e688a7bd7ea0eb73af50 (diff)
downloadpuppet-fdc8c3509b5ac5bc170c54d72b2c2bafb58409f2.tar.gz
puppet-fdc8c3509b5ac5bc170c54d72b2c2bafb58409f2.tar.xz
puppet-fdc8c3509b5ac5bc170c54d72b2c2bafb58409f2.zip
[#3994-part 3] rename spec tests from *_spec_spec to *_spec.rb
Part 2 re-did the change on the spec files, which it shouldn't have.
Diffstat (limited to 'spec/unit/parser/functions/versioncmp_spec.rb')
-rwxr-xr-xspec/unit/parser/functions/versioncmp_spec.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/unit/parser/functions/versioncmp_spec.rb b/spec/unit/parser/functions/versioncmp_spec.rb
new file mode 100755
index 000000000..0595f8711
--- /dev/null
+++ b/spec/unit/parser/functions/versioncmp_spec.rb
@@ -0,0 +1,29 @@
+#!/usr/bin/env ruby
+
+require File.dirname(__FILE__) + '/../../../spec_helper'
+
+describe "the versioncmp function" do
+
+ before :each do
+ @scope = Puppet::Parser::Scope.new()
+ end
+
+ it "should exist" do
+ Puppet::Parser::Functions.function("versioncmp").should == "function_versioncmp"
+ end
+
+ it "should raise a ParseError if there is less than 2 arguments" do
+ lambda { @scope.function_versioncmp(["1.2"]) }.should raise_error(Puppet::ParseError)
+ end
+
+ it "should raise a ParseError if there is more than 2 arguments" do
+ lambda { @scope.function_versioncmp(["1.2", "2.4.5", "3.5.6"]) }.should raise_error(Puppet::ParseError)
+ end
+
+ it "should call Puppet::Util::Package.versioncmp (included in scope)" do
+ Puppet::Util::Package.expects(:versioncmp).with("1.2", "1.3").returns(-1)
+
+ @scope.function_versioncmp(["1.2", "1.3"])
+ end
+
+end