Sha256: 9d830db51e799eb652feb594ee63d8a592290afa0e652270ce3d36cf41cb9387

Contents?: true

Size: 1.79 KB

Versions: 36

Compression:

Stored size: 1.79 KB

Contents

require 'spec_helper'
require 'puppet/util/windows'

describe "Puppet::Util::Windows::AccessControlEntry", :if => Puppet.features.microsoft_windows? do
  let(:klass) { Puppet::Util::Windows::AccessControlEntry }
  let(:sid) { 'S-1-5-18' }
  let(:mask) { Puppet::Util::Windows::File::FILE_ALL_ACCESS }

  it "creates an access allowed ace" do
    ace = klass.new(sid, mask)

    expect(ace.type).to eq(klass::ACCESS_ALLOWED_ACE_TYPE)
  end

  it "creates an access denied ace" do
    ace = klass.new(sid, mask, 0, klass::ACCESS_DENIED_ACE_TYPE)

    expect(ace.type).to eq(klass::ACCESS_DENIED_ACE_TYPE)
  end

  it "creates a non-inherited ace by default" do
    ace = klass.new(sid, mask)

    expect(ace).not_to be_inherited
  end

  it "creates an inherited ace" do
    ace = klass.new(sid, mask, klass::INHERITED_ACE)

    expect(ace).to be_inherited
  end

  it "creates a non-inherit-only ace by default" do
    ace = klass.new(sid, mask)

    expect(ace).not_to be_inherit_only
  end

  it "creates an inherit-only ace" do
    ace = klass.new(sid, mask, klass::INHERIT_ONLY_ACE)

    expect(ace).to be_inherit_only
  end

  context "when comparing aces" do
    let(:ace1) { klass.new(sid, mask, klass::INHERIT_ONLY_ACE, klass::ACCESS_DENIED_ACE_TYPE) }
    let(:ace2) { klass.new(sid, mask, klass::INHERIT_ONLY_ACE, klass::ACCESS_DENIED_ACE_TYPE) }

    it "returns true if different objects have the same set of values" do
    expect(ace1).to eq(ace2)
    end

    it "returns false if different objects have different sets of values" do
      ace = klass.new(sid, mask)
      expect(ace).not_to eq(ace1)
    end

    it "returns true when testing if two objects are eql?" do
      ace1.eql?(ace2)
    end

    it "returns false when comparing object identity" do
      expect(ace1).not_to be_equal(ace2)
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
puppet-5.5.22 spec/unit/util/windows/access_control_entry_spec.rb
puppet-5.5.22-x86-mingw32 spec/unit/util/windows/access_control_entry_spec.rb
puppet-5.5.22-x64-mingw32 spec/unit/util/windows/access_control_entry_spec.rb
puppet-5.5.22-universal-darwin spec/unit/util/windows/access_control_entry_spec.rb
puppet-5.5.21 spec/unit/util/windows/access_control_entry_spec.rb
puppet-5.5.21-x86-mingw32 spec/unit/util/windows/access_control_entry_spec.rb
puppet-5.5.21-x64-mingw32 spec/unit/util/windows/access_control_entry_spec.rb
puppet-5.5.21-universal-darwin spec/unit/util/windows/access_control_entry_spec.rb
puppet-5.5.20 spec/unit/util/windows/access_control_entry_spec.rb
puppet-5.5.20-x86-mingw32 spec/unit/util/windows/access_control_entry_spec.rb
puppet-5.5.20-x64-mingw32 spec/unit/util/windows/access_control_entry_spec.rb
puppet-5.5.20-universal-darwin spec/unit/util/windows/access_control_entry_spec.rb
puppet-5.5.19 spec/unit/util/windows/access_control_entry_spec.rb
puppet-5.5.19-x86-mingw32 spec/unit/util/windows/access_control_entry_spec.rb
puppet-5.5.19-x64-mingw32 spec/unit/util/windows/access_control_entry_spec.rb
puppet-5.5.19-universal-darwin spec/unit/util/windows/access_control_entry_spec.rb
puppet-5.5.18 spec/unit/util/windows/access_control_entry_spec.rb
puppet-5.5.18-x86-mingw32 spec/unit/util/windows/access_control_entry_spec.rb
puppet-5.5.18-x64-mingw32 spec/unit/util/windows/access_control_entry_spec.rb
puppet-5.5.18-universal-darwin spec/unit/util/windows/access_control_entry_spec.rb