Sha256: 72929ad472a1079374c53323f2f8c21f1a2a5b486687833519a4c5bc7d0ff05d
Contents?: true
Size: 920 Bytes
Versions: 304
Compression:
Stored size: 920 Bytes
Contents
require 'spec_helper' describe "the versioncmp function" do before :each do node = Puppet::Node.new('localhost') compiler = Puppet::Parser::Compiler.new(node) @scope = Puppet::Parser::Scope.new(compiler) end it "should exist" do expect(Puppet::Parser::Functions.function("versioncmp")).to eq("function_versioncmp") end it "should raise an ArgumentError if there is less than 2 arguments" do expect { @scope.function_versioncmp(["1.2"]) }.to raise_error(ArgumentError) end it "should raise an ArgumentError if there is more than 2 arguments" do expect { @scope.function_versioncmp(["1.2", "2.4.5", "3.5.6"]) }.to raise_error(ArgumentError) end it "should call Puppet::Util::Package.versioncmp (included in scope)" do expect(Puppet::Util::Package).to receive(:versioncmp).with("1.2", "1.3").and_return(-1) @scope.function_versioncmp(["1.2", "1.3"]) end end
Version data entries
304 entries across 304 versions & 1 rubygems