Sha256: 41835afc41ecdb1349ffbe75dd87aba9c72b0827e7b1e2a830522c3291ad502e

Contents?: true

Size: 1.28 KB

Versions: 13

Compression:

Stored size: 1.28 KB

Contents

#! /usr/bin/env ruby
require 'spec_helper'

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

describe provider_class do
  before(:each) do
    # Create a mock resource
    @resource = stub 'resource'

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

    # But set name and source
    @resource.stubs(:[]).with(:name).returns "mypackage"
    @resource.stubs(:[]).with(:source).returns "mysource"
    @resource.stubs(:[]).with(:ensure).returns :installed

    @provider = provider_class.new
    @provider.resource = @resource
  end

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

  describe "when installing" do
    it "should install a package" do
      @resource.stubs(:should).with(:ensure).returns(:installed)
      @provider.expects(:nimclient).with("-o", "cust", "-a", "installp_flags=acgwXY", "-a", "lpp_source=mysource", "-a", "filesets='mypackage'")
      @provider.install
    end

    it "should install a versioned package" do
      @resource.stubs(:should).with(:ensure).returns("1.2.3.4")
      @provider.expects(:nimclient).with("-o", "cust", "-a", "installp_flags=acgwXY", "-a", "lpp_source=mysource", "-a", "filesets='mypackage 1.2.3.4'")
      @provider.install
    end
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
librarian-puppet-0.9.9 vendor/gems/ruby/1.9.1/gems/puppet-3.1.0/spec/unit/provider/package/nim_spec.rb
puppet-3.1.1 spec/unit/provider/package/nim_spec.rb
librarian-puppet-0.9.8 vendor/gems/ruby/1.9.1/gems/puppet-3.1.0/spec/unit/provider/package/nim_spec.rb
puppet-3.1.0 spec/unit/provider/package/nim_spec.rb
puppet-3.1.0.rc2 spec/unit/provider/package/nim_spec.rb
puppet-3.1.0.rc1 spec/unit/provider/package/nim_spec.rb
puppet-3.0.2 spec/unit/provider/package/nim_spec.rb
puppet-3.0.2.rc3 spec/unit/provider/package/nim_spec.rb
puppet-3.0.2.rc2 spec/unit/provider/package/nim_spec.rb
puppet-3.0.2.rc1 spec/unit/provider/package/nim_spec.rb
puppet-3.0.1 spec/unit/provider/package/nim_spec.rb
puppet-3.0.1.rc1 spec/unit/provider/package/nim_spec.rb
puppet-3.0.0 spec/unit/provider/package/nim_spec.rb