Sha256: 8d9db7351793b1c46dd893b55894b73996f9102ca9aff4fda1c08bb95ae82937

Contents?: true

Size: 1.9 KB

Versions: 58

Compression:

Stored size: 1.9 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
    expect(provider).to be_versionable
  end

  it "is reinstallable" do
    expect(provider).to be_reinstallable
  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
    expect(@provider.class.eix_search_arguments).not_to include("--stable")
  end

  it "eix arguments must not include --exact" do
    expect(@provider.class.eix_search_arguments).not_to 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))
    
    expect(@provider.query[:name]).to eq("sl")
  end
end

Version data entries

58 entries across 58 versions & 1 rubygems

Version Path
puppet-4.5.3 spec/unit/provider/package/portage_spec.rb
puppet-4.5.3-x86-mingw32 spec/unit/provider/package/portage_spec.rb
puppet-4.5.3-x64-mingw32 spec/unit/provider/package/portage_spec.rb
puppet-4.5.3-universal-darwin spec/unit/provider/package/portage_spec.rb
puppet-4.5.2 spec/unit/provider/package/portage_spec.rb
puppet-4.5.2-x86-mingw32 spec/unit/provider/package/portage_spec.rb
puppet-4.5.2-x64-mingw32 spec/unit/provider/package/portage_spec.rb
puppet-4.5.2-universal-darwin spec/unit/provider/package/portage_spec.rb
puppet-4.5.1 spec/unit/provider/package/portage_spec.rb
puppet-4.5.1-x86-mingw32 spec/unit/provider/package/portage_spec.rb
puppet-4.5.1-x64-mingw32 spec/unit/provider/package/portage_spec.rb
puppet-4.5.1-universal-darwin spec/unit/provider/package/portage_spec.rb
puppet-4.5.0 spec/unit/provider/package/portage_spec.rb
puppet-4.5.0-x86-mingw32 spec/unit/provider/package/portage_spec.rb
puppet-4.5.0-x64-mingw32 spec/unit/provider/package/portage_spec.rb
puppet-4.5.0-universal-darwin spec/unit/provider/package/portage_spec.rb
puppet-4.4.2 spec/unit/provider/package/portage_spec.rb
puppet-4.4.2-x86-mingw32 spec/unit/provider/package/portage_spec.rb
puppet-4.4.2-x64-mingw32 spec/unit/provider/package/portage_spec.rb
puppet-4.4.2-universal-darwin spec/unit/provider/package/portage_spec.rb