Sha256: bee301367d451bf74275cc7259ca1e12d03efc2e5a39635a99cdb84af7047b01

Contents?: true

Size: 1.02 KB

Versions: 47

Compression:

Stored size: 1.02 KB

Contents

require 'test_puppet_helper'

module ForemanPuppet
  class PuppetclassesHelperTest < ActionView::TestCase
    include PuppetclassesHelper

    describe '.overridden?' do
      setup do
        @env = FactoryBot.create(:environment)
      end

      it 'returns true when all params are overridden' do
        pc = FactoryBot.create(:puppetclass, :with_parameters, environments: [@env])
        pc.class_params.first.update(override: true)
        assert pc.class_params.first.override
        assert overridden?(pc)
      end

      it "returns false when one parameter isn't overridden" do
        pc = FactoryBot.create(:puppetclass, :with_parameters, parameter_count: 2, environments: [@env])
        pc.class_params.first.update(override: true)
        assert pc.class_params.first.override
        assert_not pc.class_params.last.override
        assert_not overridden?(pc)
      end

      it 'returns false when no parameters' do
        pc = FactoryBot.create(:puppetclass)
        assert_not overridden?(pc)
      end
    end
  end
end

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
foreman_puppet-8.0.0 test/helpers/foreman_puppet/puppetclasses_helper_test.rb
foreman_puppet-6.4.0 test/helpers/foreman_puppet/puppetclasses_helper_test.rb
foreman_puppet-7.0.0 test/helpers/foreman_puppet/puppetclasses_helper_test.rb
foreman_puppet-6.3.0 test/helpers/foreman_puppet/puppetclasses_helper_test.rb
foreman_puppet-6.2.0 test/helpers/foreman_puppet/puppetclasses_helper_test.rb
foreman_puppet-6.1.1 test/helpers/foreman_puppet/puppetclasses_helper_test.rb
foreman_puppet-5.1.3 test/helpers/foreman_puppet/puppetclasses_helper_test.rb
foreman_puppet-6.1.0 test/helpers/foreman_puppet/puppetclasses_helper_test.rb
foreman_puppet-6.0.1 test/helpers/foreman_puppet/puppetclasses_helper_test.rb
foreman_puppet-6.0.0 test/helpers/foreman_puppet/puppetclasses_helper_test.rb
foreman_puppet-5.1.2 test/helpers/foreman_puppet/puppetclasses_helper_test.rb
foreman_puppet-4.1.1 test/helpers/foreman_puppet/puppetclasses_helper_test.rb
foreman_puppet-5.1.1 test/helpers/foreman_puppet/puppetclasses_helper_test.rb
foreman_puppet-5.1.0 test/helpers/foreman_puppet/puppetclasses_helper_test.rb
foreman_puppet-4.1.0 test/helpers/foreman_puppet/puppetclasses_helper_test.rb
foreman_puppet-4.0.4 test/helpers/foreman_puppet/puppetclasses_helper_test.rb
foreman_puppet-5.0.0 test/helpers/foreman_puppet/puppetclasses_helper_test.rb
foreman_puppet-4.0.3 test/helpers/foreman_puppet/puppetclasses_helper_test.rb
foreman_puppet-4.0.2 test/helpers/foreman_puppet/puppetclasses_helper_test.rb
foreman_puppet-3.0.7 test/helpers/foreman_puppet/puppetclasses_helper_test.rb