require 'spec_helper_acceptance' require_relative 'support/pkg_rpm_helpers' RSpec.configure do |c| c.include Simp::BeakerHelpers::SimpRakeHelpers::PkgRpmHelpers c.extend Simp::BeakerHelpers::SimpRakeHelpers::PkgRpmHelpers end shared_examples_for 'an RPM generator with customized scriptlets' do it 'should create an RPM with customized scriptlets' do scriptlets = rpm_scriptlets_for( host, "#{pkg_root_dir}/testpackage_custom_scriptlet/dist/" + 'pupmod-simp-testpackage-0.0.1-0.noarch.rpm' ) comment '...the expected scriptlet types are present' expect(scriptlets.keys.sort).to eq [ 'pretrans', 'preinstall', 'posttrans', 'preuninstall', 'postuninstall', ].sort comment '...there are no duplicates' # this *should* be impossible expect(scriptlets.map{|k,v| v[:count]}.max).to be == 1 comment '...pretrans scriptlet contains custom content' expect(scriptlets['pretrans'][:content]).to eq '-- Custom scriptlet' comment '...preinstall scriptlet has been overridden with custom content' expect(scriptlets['preinstall'][:bare_content]).to eq( "echo 'I override the default %%pre section provided by the spec file.'" ) comment '...default preun postun scriptlets call simp_rpm_helper with correct arguments' expected_simp_rpm_helper_scriptlets = scriptlet_label_map.select{|k,v| %w(preun postun).include? v } expected_simp_rpm_helper_scriptlets.each do |rpm_label, simp_helper_label| expected = <