+1

On Tue, Oct 5, 2010 at 3:28 PM, Matt Robinson <[email protected]> wrote:
> From: Dan Bode <[email protected]>
>
>
> Signed-off-by: Matt Robinson <[email protected]>
> ---
>  spec/unit/provider/package/yum_spec.rb |   61 
> ++++++++++++++++++++++++++++++++
>  1 files changed, 61 insertions(+), 0 deletions(-)
>  create mode 100644 spec/unit/provider/package/yum_spec.rb
>
> diff --git a/spec/unit/provider/package/yum_spec.rb 
> b/spec/unit/provider/package/yum_spec.rb
> new file mode 100644
> index 0000000..09c81f7
> --- /dev/null
> +++ b/spec/unit/provider/package/yum_spec.rb
> @@ -0,0 +1,61 @@
> +#!/usr/bin/env ruby
> +
> +require File.dirname(__FILE__) + '/../../../spec_helper'
> +
> +provider = Puppet::Type.type(:package).provider(:yum)
> +
> +describe provider do
> +  before do
> +    # Create a mock resource
> +     @resource = stub 'resource'
> +     @resource.stubs(:[]).with(:name).returns 'mypackage'
> +     @provider = provider.new(@resource)
> +     @provider.stubs(:resource).returns @resource
> +     @provider.stubs(:yum).returns 'yum'
> +     @provider.stubs(:rpm).returns 'rpm'
> +     @provider.stubs(:get).with(:name).returns 'mypackage'
> +     @provider.stubs(:get).with(:version).returns '1'
> +     @provider.stubs(:get).with(:release).returns '1'
> +     @provider.stubs(:get).with(:arch).returns 'i386'
> +  end
> +  # provider should repond to the following methods
> +   [:install, :latest, :update, :purge].each do |method|
> +     it "should have a(n) #{method}" do
> +       @provider.should respond_to(method)
> +    end
> +  end
> +
> +  describe 'when installing' do
> +    it 'should call yum install for :installed' do
> +     �[email protected](:should).with(:ensure).returns :installed
> +     �[email protected](:yum).with('-d', '0', '-e', '0', '-y', :install, 
> 'mypackage')
> +     �[email protected]
> +    end
> +    it "should use :install to update" do
> +     �[email protected](:install)
> +     �[email protected]
> +    end
> +    it "should be able to set version" do
> +     �[email protected](:should).with(:ensure).returns "1.2"
> +     �[email protected](:yum).with('-d', '0', '-e', '0', '-y', :install, 
> 'mypackage-1.2')
> +     �[email protected](:query).returns :ensure => '1.2'
> +     �[email protected]
> +    end
> +  end
> +
> +  describe 'when uninstalling' do
> +    it "should use erase to purge" do
> +     �[email protected](:yum).with("-y", :erase, 'mypackage')
> +     �[email protected]
> +    end
> +    it 'should use rpm to uninstall' do
> +     �[email protected](:rpm).with('-e', 'mypackage-1-1.i386')
> +     �[email protected]
> +    end
> +  end
> +
> +  it "should be versionable" do
> +    provider.should be_versionable
> +  end
> +end
> +
> --
> 1.7.1
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Puppet Developers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/puppet-dev?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to