Sha256: 37fd1e8edcf5ad9cc82a9d5b77af373f259bdb44b68019f916214473d42a4997

Contents?: true

Size: 1.26 KB

Versions: 27

Compression:

Stored size: 1.26 KB

Contents

require 'spec_helper'

module Beaker
  describe FreeBSD::Pkg do
    class FreeBSDPkgTest
      include FreeBSD::Pkg

      def initialize(hash, logger)
        @hash = hash
        @logger = logger
      end

      def [](k)
        @hash[k]
      end

      def to_s
        "me"
      end

      def exec
        #noop
      end

    end

    let (:opts)     { @opts || {} }
    let (:logger)   { double( 'logger' ).as_null_object }
    let (:instance) { FreeBSDPkgTest.new(opts, logger) }

    context "install_package" do

      it "runs the correct install command" do
        expect( Beaker::Command ).to receive(:new).with('pkg install -y rsync', [], {:prepend_cmds=>nil, :cmdexe=>false}).and_return('')
        expect( instance ).to receive(:exec).with('', {}).and_return(generate_result("hello", {:exit_code => 0}))
        instance.install_package('rsync')
      end

    end

    context "check_for_package" do

      it "runs the correct checking command" do
        expect( Beaker::Command ).to receive(:new).with('pkg info rsync', [], {:prepend_cmds=>nil, :cmdexe=>false}).and_return('')
        expect( instance ).to receive(:exec).with('', {}).and_return(generate_result("hello", {:exit_code => 0}))
        instance.check_for_package('rsync')
      end

    end

  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
beaker-2.52.0 spec/beaker/host/freebsd/pkg_spec.rb
beaker-3.1.0 spec/beaker/host/freebsd/pkg_spec.rb
beaker-3.0.0 spec/beaker/host/freebsd/pkg_spec.rb
beaker-2.51.0 spec/beaker/host/freebsd/pkg_spec.rb
beaker-2.50.0 spec/beaker/host/freebsd/pkg_spec.rb
beaker-2.49.0 spec/beaker/host/freebsd/pkg_spec.rb
beaker-2.48.1 spec/beaker/host/freebsd/pkg_spec.rb
beaker-2.48.0 spec/beaker/host/freebsd/pkg_spec.rb
beaker-2.47.1 spec/beaker/host/freebsd/pkg_spec.rb
beaker-2.47.0 spec/beaker/host/freebsd/pkg_spec.rb
beaker-2.46.0 spec/beaker/host/freebsd/pkg_spec.rb
beaker-2.45.0 spec/beaker/host/freebsd/pkg_spec.rb
beaker-2.44.0 spec/beaker/host/freebsd/pkg_spec.rb
beaker-2.43.0 spec/beaker/host/freebsd/pkg_spec.rb
beaker-2.42.0 spec/beaker/host/freebsd/pkg_spec.rb
beaker-2.41.0 spec/beaker/host/freebsd/pkg_spec.rb
beaker-2.40.0 spec/beaker/host/freebsd/pkg_spec.rb
beaker-2.39.0 spec/beaker/host/freebsd/pkg_spec.rb
beaker-2.38.1 spec/beaker/host/freebsd/pkg_spec.rb
beaker-2.38.0 spec/beaker/host/freebsd/pkg_spec.rb