Sha256: 0cef4d9a691f43410b6e4db31e3971f1c0d8e9f22c637bec2243c2901291be6f

Contents?: true

Size: 1.05 KB

Versions: 8

Compression:

Stored size: 1.05 KB

Contents

require 'spec_helper'

module Beaker
  describe Mac::Exec do
    class MacExecTest
      include Mac::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) { MacExecTest.new(opts, logger) }

    describe '#selinux_enabled?' do
      it 'does not call selinuxenabled' do
        expect(Beaker::Command).not_to receive(:new).with("sudo selinuxenabled")
        expect(instance).not_to receive(:exec).with(0, :accept_all_exit_codes => true)
        expect(instance.selinux_enabled?).to be === false
      end
    end

    describe '#modified_at' do
      it 'calls execute with touch and timestamp' do
        time = '190101010000'
        path = '/path/to/file'
        expect( instance ).to receive(:execute).with("touch -mt #{time} #{path}").and_return(0)

        instance.modified_at(path, time)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

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