Report abuse


			
#!/usr/bin/env ruby

require File.dirname(__FILE__) + '/../../../../spec_helper'
require 'puppet/provider/package/gem'

provider_class = Puppet::Type.type(:package).provider(:gem)

describe provider_class do
  before do
    @provider = provider_class.new
  end

  it "should have an install method" do
    @provider.should respond_to(:install)
  end

  describe "when installing" do
    before do
      @resource = mock 'resource'

      # A catch all; no parameters set
      @resource.stubs(:[]).returns nil

      # We have to set a name, though
      @resource.stubs(:[]).with(:name).returns "myresource"
    end

    it "should execute the gem command with 'install', dependencies, and the package name" do
      @provider.expects(:gemcmd).with(:install, "--include-dependences", "myresource")
      @provider.install
    end
  end
end