Sha256: f08ecd5040086ae9611c23b087172b0af96b037b72504834552cd15e4acc7d20

Contents?: true

Size: 1.04 KB

Versions: 16

Compression:

Stored size: 1.04 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

16 entries across 16 versions & 1 rubygems

Version Path
beaker-6.4.1 spec/beaker/host/mac/exec_spec.rb
beaker-6.4.0 spec/beaker/host/mac/exec_spec.rb
beaker-6.3.0 spec/beaker/host/mac/exec_spec.rb
beaker-6.2.0 spec/beaker/host/mac/exec_spec.rb
beaker-6.1.0 spec/beaker/host/mac/exec_spec.rb
beaker-5.8.1 spec/beaker/host/mac/exec_spec.rb
beaker-5.8.0 spec/beaker/host/mac/exec_spec.rb
beaker-5.7.0 spec/beaker/host/mac/exec_spec.rb
beaker-5.6.0 spec/beaker/host/mac/exec_spec.rb
beaker-5.5.0 spec/beaker/host/mac/exec_spec.rb
beaker-5.4.0 spec/beaker/host/mac/exec_spec.rb
beaker-5.3.1 spec/beaker/host/mac/exec_spec.rb
beaker-5.3.0 spec/beaker/host/mac/exec_spec.rb
beaker-5.2.0 spec/beaker/host/mac/exec_spec.rb
beaker-5.1.0 spec/beaker/host/mac/exec_spec.rb
beaker-5.0.0 spec/beaker/host/mac/exec_spec.rb