diff options
-rwxr-xr-x | lib/puppet/provider/package/gem.rb | 14 | ||||
-rw-r--r-- | spec/unit/provider/package/gem.rb | 48 |
2 files changed, 31 insertions, 31 deletions
diff --git a/lib/puppet/provider/package/gem.rb b/lib/puppet/provider/package/gem.rb index 277fc68cc..373af431e 100755 --- a/lib/puppet/provider/package/gem.rb +++ b/lib/puppet/provider/package/gem.rb @@ -79,16 +79,16 @@ Puppet::Type.type(:package).provide :gem, :parent => Puppet::Provider::Package d scheme = URI.parse(blah).scheme rescue nil # the URI scheme if there is one, nil otherwise if scheme.nil? - # no URI scheme => interpret the source as a local file - command << source + # no URI scheme => interpret the source as a local file + command << source elsif scheme.downcase == "file" - command << source.path + command << source.path elsif scheme.downcase == "puppet" - # we don't support puppet:// URLs (yet) - raise Puppet::Error.new("puppet:// URLs are not supported as gem sources") + # we don't support puppet:// URLs (yet) + raise Puppet::Error.new("puppet:// URLs are not supported as gem sources") else - # interpret it as a gem repository - command << "--source" << "#{source}" << @resource[:name] + # interpret it as a gem repository + command << "--source" << "#{source}" << @resource[:name] end else command << @resource[:name] diff --git a/spec/unit/provider/package/gem.rb b/spec/unit/provider/package/gem.rb index fcd8bf4ae..24f2ad66d 100644 --- a/spec/unit/provider/package/gem.rb +++ b/spec/unit/provider/package/gem.rb @@ -1,39 +1,39 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../../spec_helper' +require File.dirname(__FILE__) + '/../../../spec_helper' require 'puppet/provider/package/gem' provider_class = Puppet::Type.type(:package).provider(:gem) describe provider_class do - it "should have an install method" do - @provider = provider_class.new - @provider.should respond_to(:install) - end + it "should have an install method" do + @provider = provider_class.new + @provider.should respond_to(:install) + end - describe "when installing" do - before do - # Create a mock resource - @resource = mock 'resource' + describe "when installing" do + before do + # Create a mock resource + @resource = mock 'resource' - # A catch all; no parameters set - @resource.stubs(:[]).returns nil + # A catch all; no parameters set + @resource.stubs(:[]).returns nil - # We have to set a name, though - @resource.stubs(:[]).with(:name).returns "myresource" + # We have to set a name, though + @resource.stubs(:[]).with(:name).returns "myresource" - # BTW, you get odd error messages from rspec if you forget to mock "should" here... - @resource.stubs(:should).with(:ensure).returns :installed + # BTW, you get odd error messages from rspec if you forget to mock "should" here... + @resource.stubs(:should).with(:ensure).returns :installed - @provider = provider_class.new - @provider.stubs(:resource).returns @resource - # Create a provider that uses the mock -# @provider = provider_class.new(@resource) - end + @provider = provider_class.new + @provider.stubs(:resource).returns @resource + # Create a provider that uses the mock +# @provider = provider_class.new(@resource) + end - it "should execute the gem command with 'install', dependencies, and the package name" do - @provider.expects(:execute).with(provider_class.command(:gemcmd), 'install', "--include-dependences", "myresource") - @provider.install + it "should execute the gem command with 'install', dependencies, and the package name" do + @provider.expects(:execute).with(provider_class.command(:gemcmd), 'install', "--include-dependences", "myresource") + @provider.install + end end - end end |