Sha256: b46cbec6649bae30ade102e5aefb7f75bc7e4a4f7463294b13faa213bc4f377e
Contents?: true
Size: 1.4 KB
Versions: 3
Compression:
Stored size: 1.4 KB
Contents
#!/usr/bin/env ruby # # Created by Luke Kanies on 2007-10-18. # Copyright (c) 2007. All rights reserved. require File.dirname(__FILE__) + '/../../spec_helper' require 'puppet/util/uri_helper' describe Puppet::Util::URIHelper, " when converting a key to a URI" do before do @helper = Object.new @helper.extend(Puppet::Util::URIHelper) end it "should return the URI instance" do URI.expects(:parse).with("file:///myhost/blah").returns(:myuri) @helper.key2uri("/myhost/blah").should == :myuri end it "should escape the key before parsing" do URI.expects(:escape).with("mykey").returns("http://myhost/blah") URI.expects(:parse).with("http://myhost/blah").returns(:myuri) @helper.key2uri("mykey").should == :myuri end it "should use the URI class to parse the key" do URI.expects(:parse).with("http://myhost/blah").returns(:myuri) @helper.key2uri("http://myhost/blah").should == :myuri end it "should set the scheme to 'file' if the key is a fully qualified path" do URI.expects(:parse).with("file:///myhost/blah").returns(:myuri) @helper.key2uri("/myhost/blah").should == :myuri end it "should set the host to 'nil' if the key is a fully qualified path" do URI.expects(:parse).with("file:///myhost/blah").returns(:myuri) @helper.key2uri("/myhost/blah").should == :myuri end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
puppet-0.24.9 | spec/unit/util/uri_helper.rb |
puppet-0.24.7 | spec/unit/util/uri_helper.rb |
puppet-0.24.8 | spec/unit/util/uri_helper.rb |