summaryrefslogtreecommitdiff
path: root/spec/unit/provider/package
diff options
context:
space:
mode:
authorsonots <sonots@gmail.com>2015-01-16 06:24:16 +0900
committerBryan McLellan <btm@opscode.com>2015-02-09 21:15:48 -0500
commit1a9681d4e65be2e194a5393d14102d696053bbff (patch)
tree8663de60089b5c9206debb0c2e0aea5d68826a2d /spec/unit/provider/package
parentda09f6efd82b13362757e8dea589aa1d0c02eb90 (diff)
downloadchef-1a9681d4e65be2e194a5393d14102d696053bbff.tar.gz
Support HTTP/FTP source on rpm_package
Diffstat (limited to 'spec/unit/provider/package')
-rw-r--r--spec/unit/provider/package/rpm_spec.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/unit/provider/package/rpm_spec.rb b/spec/unit/provider/package/rpm_spec.rb
index 07c5dea8c6..ea126e1fb8 100644
--- a/spec/unit/provider/package/rpm_spec.rb
+++ b/spec/unit/provider/package/rpm_spec.rb
@@ -72,6 +72,32 @@ describe Chef::Provider::Package::Rpm do
end
end
+ context "source is uri formed" do
+ before(:each) do
+ allow(::File).to receive(:exists?).and_return(false)
+ end
+
+ %w(http HTTP https HTTPS ftp FTP).each do |scheme|
+ it "should accept uri formed source (#{scheme})" do
+ new_resource.source "#{scheme}://example.com/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm"
+ expect(provider.load_current_resource).not_to be_nil
+ end
+ end
+
+ %w(file FILE).each do |scheme|
+ it "should accept uri formed source (#{scheme})" do
+ new_resource.source "#{scheme}:///ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm"
+ expect(provider.load_current_resource).not_to be_nil
+ end
+ end
+
+ it "should raise an exception if an uri formed source is non-supported scheme" do
+ new_resource.source "foobar://example.com/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm"
+ expect(provider.load_current_resource).to be_nil
+ expect { provider.run_action(:any) }.to raise_error(Chef::Exceptions::Package)
+ end
+ end
+
context "source is not defiend" do
let(:new_resource) { Chef::Resource::Package.new("ImageMagick-c++") }