Sha256: e9bf6f825b96513af18d45a40873ceec295a0f838b748c2ac8a214ad0273377c

Contents?: true

Size: 1.8 KB

Versions: 12

Compression:

Stored size: 1.8 KB

Contents

require 'spec_helper'

# Note that much of the functionality of the dnf provider is already tested with yum provider tests,
# as yum is the parent provider.
describe Puppet::Type.type(:package).provider(:dnf) do
  context 'default' do
    (19..21).each do |ver|
      it "should not be the default provider on fedora#{ver}" do
        allow(Facter).to receive(:value).with(:osfamily).and_return(:redhat)
        allow(Facter).to receive(:value).with(:operatingsystem).and_return(:fedora)
        allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("#{ver}")
        expect(described_class).to_not be_default
      end
    end

    (22..26).each do |ver|
      it "should be the default provider on fedora#{ver}" do
        allow(Facter).to receive(:value).with(:osfamily).and_return(:redhat)
        allow(Facter).to receive(:value).with(:operatingsystem).and_return(:fedora)
        allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("#{ver}")
        expect(described_class).to be_default
      end
    end

    it "should not be the default provider on rhel7" do
      allow(Facter).to receive(:value).with(:osfamily).and_return(:redhat)
      allow(Facter).to receive(:value).with(:operatingsystem).and_return(:redhat)
      allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("7")
      expect(described_class).to_not be_default
    end

    it "should be the default provider on rhel8" do
      allow(Facter).to receive(:value).with(:osfamily).and_return(:redhat)
      allow(Facter).to receive(:value).with(:operatingsystem).and_return(:redhat)
      allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("8")
      expect(described_class).to be_default
    end
  end

  it_behaves_like 'RHEL package provider', described_class, 'dnf'
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
puppet-5.5.16 spec/unit/provider/package/dnf_spec.rb
puppet-5.5.16-x86-mingw32 spec/unit/provider/package/dnf_spec.rb
puppet-5.5.16-x64-mingw32 spec/unit/provider/package/dnf_spec.rb
puppet-5.5.16-universal-darwin spec/unit/provider/package/dnf_spec.rb
puppet-5.5.14 spec/unit/provider/package/dnf_spec.rb
puppet-5.5.14-x86-mingw32 spec/unit/provider/package/dnf_spec.rb
puppet-5.5.14-x64-mingw32 spec/unit/provider/package/dnf_spec.rb
puppet-5.5.14-universal-darwin spec/unit/provider/package/dnf_spec.rb
puppet-5.5.13 spec/unit/provider/package/dnf_spec.rb
puppet-5.5.13-x86-mingw32 spec/unit/provider/package/dnf_spec.rb
puppet-5.5.13-x64-mingw32 spec/unit/provider/package/dnf_spec.rb
puppet-5.5.13-universal-darwin spec/unit/provider/package/dnf_spec.rb