Sha256: 72eacd4a236846c0cfa80b1c48c18272a9ef6192dff016507e4144fe937cb120

Contents?: true

Size: 1.05 KB

Versions: 27

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

27 entries across 27 versions & 1 rubygems

Version Path
beaker-4.38.1 spec/beaker/host/mac/exec_spec.rb
beaker-4.38.0 spec/beaker/host/mac/exec_spec.rb
beaker-4.37.2 spec/beaker/host/mac/exec_spec.rb
beaker-4.37.1 spec/beaker/host/mac/exec_spec.rb
beaker-4.37.0 spec/beaker/host/mac/exec_spec.rb
beaker-4.36.1 spec/beaker/host/mac/exec_spec.rb
beaker-4.36.0 spec/beaker/host/mac/exec_spec.rb
beaker-4.35.0 spec/beaker/host/mac/exec_spec.rb
beaker-4.34.0 spec/beaker/host/mac/exec_spec.rb
beaker-4.33.0 spec/beaker/host/mac/exec_spec.rb
beaker-4.32.0 spec/beaker/host/mac/exec_spec.rb
beaker-4.31.0 spec/beaker/host/mac/exec_spec.rb
beaker-4.30.0 spec/beaker/host/mac/exec_spec.rb
beaker-4.29.1 spec/beaker/host/mac/exec_spec.rb
beaker-4.29.0 spec/beaker/host/mac/exec_spec.rb
beaker-4.28.1 spec/beaker/host/mac/exec_spec.rb
beaker-4.28.0 spec/beaker/host/mac/exec_spec.rb
beaker-4.27.1 spec/beaker/host/mac/exec_spec.rb
beaker-4.27.0 spec/beaker/host/mac/exec_spec.rb
beaker-4.26.0 spec/beaker/host/mac/exec_spec.rb