require 'spec_helper'

describe "the pget_filename function" do
  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }

  it "should exist" do
    Puppet::Parser::Functions.function("pget_filename").should == "function_pget_filename"
  end
  it "should return msi file" do
    ["c:/Program Files/puppet-3.4.1.msi","http://downloads.puppetlabs.com/windows/puppet-3.4.1.msi","puppet://extra_files/puppet-3.4.1.msi", "http://downloads.puppetlabs.com/windows/puppet-3.4.1.msi?parameter1=value1&parameter2=value2"].each {|item|
      result = scope.function_pget_filename([item])
      result.should(eq("puppet-3.4.1.msi"))
    }
  end
end


require 'spec_helper'

describe "the pget_filename function" do
  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }

  it "should exist" do
    Puppet::Parser::Functions.function("pget_filename").should == "function_pget_filename"
  end
  it "should return msi file" do
    ["c:/Program Files/puppet-3.4.1.msi","http://downloads.puppetlabs.com/windows/puppet-3.4.1.msi","puppet://extra_files/puppet-3.4.1.msi"].each {|item|
      result = scope.function_pget_filename([item])
      result.should(eq("puppet-3.4.1.msi"))
    }
  end
end


--- 
+++ 
@@ -7,7 +7,7 @@
     Puppet::Parser::Functions.function("pget_filename").should == "function_pget_filename"
   end
   it "should return msi file" do
-    ["c:/Program Files/puppet-3.4.1.msi","http://downloads.puppetlabs.com/windows/puppet-3.4.1.msi","puppet://extra_files/puppet-3.4.1.msi"].each {|item|
+    ["c:/Program Files/puppet-3.4.1.msi","http://downloads.puppetlabs.com/windows/puppet-3.4.1.msi","puppet://extra_files/puppet-3.4.1.msi", "http://downloads.puppetlabs.com/windows/puppet-3.4.1.msi?parameter1=value1&parameter2=value2"].each {|item|
       result = scope.function_pget_filename([item])
       result.should(eq("puppet-3.4.1.msi"))
     }
Add test for URI with parameters
