Sha256: fbda6bf8f75af59909c4aad047c78cde94a630ce58b25604353ae7688831348d

Contents?: true

Size: 1.81 KB

Versions: 84

Compression:

Stored size: 1.81 KB

Contents

#! /usr/bin/env ruby

require 'spec_helper'

provider = Puppet::Type.type(:package).provider(:portage)

describe provider do
  before do
    packagename="sl"
    @resource = stub('resource', :[] => packagename,:should => true)
    @provider = provider.new(@resource)
    
    portage   = stub(:executable => "foo",:execute => true)
    Puppet::Provider::CommandDefiner.stubs(:define).returns(portage)

    @nomatch_result = ""
    @match_result   = "app-misc sl [] [] http://www.tkl.iis.u-tokyo.ac.jp/~toyoda/index_e.html http://www.izumix.org.uk/sl/ sophisticated graphical program which corrects your miss typing\n"
  end

  it "is versionable" do
    provider.should be_versionable
  end

  it "uses :emerge to install packages" do
    @provider.expects(:emerge)
    
    @provider.install
  end

  it "uses query to find the latest package" do
    @provider.expects(:query).returns({:versions_available => "myversion"})
    
    @provider.latest
  end

  it "uses eix to search the lastest version of a package" do
    @provider.stubs(:update_eix)
    @provider.expects(:eix).returns(StringIO.new(@match_result))
    
    @provider.query
  end

  it "eix arguments must not include --stable" do
    @provider.class.eix_search_arguments.should_not include("--stable")
  end

  it "eix arguments must not include --exact" do
    @provider.class.eix_search_arguments.should_not include("--exact")
  end

  it "query uses default arguments" do
    @provider.stubs(:update_eix)
    @provider.expects(:eix).returns(StringIO.new(@match_result))
    @provider.class.expects(:eix_search_arguments).returns([])
    
    @provider.query
  end

  it "can handle search output with empty square brackets" do
    @provider.stubs(:update_eix)
    @provider.expects(:eix).returns(StringIO.new(@match_result))
    
    @provider.query[:name].should eq("sl")
  end
end

Version data entries

84 entries across 84 versions & 2 rubygems

Version Path
puppet-3.8.7 spec/unit/provider/package/portage_spec.rb
puppet-3.8.7-x86-mingw32 spec/unit/provider/package/portage_spec.rb
puppet-3.8.7-x64-mingw32 spec/unit/provider/package/portage_spec.rb
puppet-3.8.6 spec/unit/provider/package/portage_spec.rb
puppet-3.8.6-x86-mingw32 spec/unit/provider/package/portage_spec.rb
puppet-3.8.6-x64-mingw32 spec/unit/provider/package/portage_spec.rb
puppet-3.8.5 spec/unit/provider/package/portage_spec.rb
puppet-3.8.5-x86-mingw32 spec/unit/provider/package/portage_spec.rb
puppet-3.8.5-x64-mingw32 spec/unit/provider/package/portage_spec.rb
puppet-3.8.4 spec/unit/provider/package/portage_spec.rb
puppet-3.8.4-x86-mingw32 spec/unit/provider/package/portage_spec.rb
puppet-3.8.4-x64-mingw32 spec/unit/provider/package/portage_spec.rb
puppet-3.8.3 spec/unit/provider/package/portage_spec.rb
puppet-3.8.3-x86-mingw32 spec/unit/provider/package/portage_spec.rb
puppet-3.8.3-x64-mingw32 spec/unit/provider/package/portage_spec.rb
puppet-3.8.2 spec/unit/provider/package/portage_spec.rb
puppet-3.8.2-x86-mingw32 spec/unit/provider/package/portage_spec.rb
puppet-3.8.2-x64-mingw32 spec/unit/provider/package/portage_spec.rb
puppet-3.8.1 spec/unit/provider/package/portage_spec.rb
puppet-3.8.1-x86-mingw32 spec/unit/provider/package/portage_spec.rb