Sha256: 18fac357aa7b62583c3dfe34a81f44cf687c9c80b9a67014f95b3d82ccf60100

Contents?: true

Size: 915 Bytes

Versions: 2

Compression:

Stored size: 915 Bytes

Contents

#!/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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
puppet-0.24.9 spec/unit/parser/functions/versioncmp.rb
puppet-0.24.8 spec/unit/parser/functions/versioncmp.rb