Sha256: 0fb8436728316ee13cdd0d5d3323a771e54d7f84117d8f36b21f70fd165d3ae2

Contents?: true

Size: 961 Bytes

Versions: 8

Compression:

Stored size: 961 Bytes

Contents

require 'spec_helper'

module Beaker
  describe FreeBSD::Exec do
    class FreeBSDExecTest
      include FreeBSD::Exec

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

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

      def to_s
        "me"
      end
    end

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

    context "echo_to_file" do

      it "runs the correct echo command" do
        expect( Beaker::Command ).to receive(:new).with('printf "127.0.0.1\tlocalhost localhost.localdomain\n10.255.39.23\tfreebsd-10-x64\n" > /etc/hosts').and_return('')
        expect( instance ).to receive(:exec).with('').and_return(generate_result("hello", {:exit_code => 0}))
        instance.echo_to_file('127.0.0.1\tlocalhost localhost.localdomain\n10.255.39.23\tfreebsd-10-x64\n', '/etc/hosts')
      end

    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
beaker-4.42.0 spec/beaker/host/freebsd/exec_spec.rb
beaker-4.41.2 spec/beaker/host/freebsd/exec_spec.rb
beaker-4.41.1 spec/beaker/host/freebsd/exec_spec.rb
beaker-4.41.0 spec/beaker/host/freebsd/exec_spec.rb
beaker-4.40.2 spec/beaker/host/freebsd/exec_spec.rb
beaker-4.40.1 spec/beaker/host/freebsd/exec_spec.rb
beaker-4.40.0 spec/beaker/host/freebsd/exec_spec.rb
beaker-4.39.0 spec/beaker/host/freebsd/exec_spec.rb