Sha256: da199ebf97fa88c49bc00fc71898ab63cfd16a449932d30bcb3b595a8abfb00e

Contents?: true

Size: 1.28 KB

Versions: 36

Compression:

Stored size: 1.28 KB

Contents

require 'spec_helper'

provider_class = Puppet::Type.type(:selboolean).provider(:getsetsebool)

describe provider_class do
  before :each do
    @resource = double("resource", :name => "foo")
    allow(@resource).to receive(:[]).and_return("foo")
    @provider = provider_class.new(@resource)
  end

  it "should return :on when getsebool returns on" do
    expect(@provider).to receive(:getsebool).with("foo").and_return("foo --> on\n")
    expect(@provider.value).to eq(:on)
  end

  it "should return :off when getsebool returns on" do
    expect(@provider).to receive(:getsebool).with("foo").and_return("foo --> off\n")
    expect(@provider.value).to eq(:off)
  end

  it "should call execpipe when updating boolean setting" do
    expect(@provider).to receive(:command).with(:setsebool).and_return("/usr/sbin/setsebool")
    expect(@provider).to receive(:execpipe).with("/usr/sbin/setsebool  foo off")
    @provider.value = :off
  end

  it "should call execpipe with -P when updating persistent boolean setting" do
    allow(@resource).to receive(:[]).with(:persistent).and_return(:true)
    expect(@provider).to receive(:command).with(:setsebool).and_return("/usr/sbin/setsebool")
    expect(@provider).to receive(:execpipe).with("/usr/sbin/setsebool -P foo off")
    @provider.value = :off
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
puppet-5.5.22 spec/unit/provider/selboolean_spec.rb
puppet-5.5.22-x86-mingw32 spec/unit/provider/selboolean_spec.rb
puppet-5.5.22-x64-mingw32 spec/unit/provider/selboolean_spec.rb
puppet-5.5.22-universal-darwin spec/unit/provider/selboolean_spec.rb
puppet-5.5.21 spec/unit/provider/selboolean_spec.rb
puppet-5.5.21-x86-mingw32 spec/unit/provider/selboolean_spec.rb
puppet-5.5.21-x64-mingw32 spec/unit/provider/selboolean_spec.rb
puppet-5.5.21-universal-darwin spec/unit/provider/selboolean_spec.rb
puppet-5.5.20 spec/unit/provider/selboolean_spec.rb
puppet-5.5.20-x86-mingw32 spec/unit/provider/selboolean_spec.rb
puppet-5.5.20-x64-mingw32 spec/unit/provider/selboolean_spec.rb
puppet-5.5.20-universal-darwin spec/unit/provider/selboolean_spec.rb
puppet-5.5.19 spec/unit/provider/selboolean_spec.rb
puppet-5.5.19-x86-mingw32 spec/unit/provider/selboolean_spec.rb
puppet-5.5.19-x64-mingw32 spec/unit/provider/selboolean_spec.rb
puppet-5.5.19-universal-darwin spec/unit/provider/selboolean_spec.rb
puppet-5.5.18 spec/unit/provider/selboolean_spec.rb
puppet-5.5.18-x86-mingw32 spec/unit/provider/selboolean_spec.rb
puppet-5.5.18-x64-mingw32 spec/unit/provider/selboolean_spec.rb
puppet-5.5.18-universal-darwin spec/unit/provider/selboolean_spec.rb