- it { should contain_apt__params }
-
- it { should contain_file("#{title}.list").with({
- 'ensure' => param_hash[:ensure],
- 'path' => filename,
- 'owner' => 'root',
- 'group' => 'root',
- 'mode' => '0644',
- 'content' => content,
- })
- }
-
- it {
- if param_hash[:pin]
- should contain_apt__pin(title).with({
- "priority" => param_hash[:pin],
- "before" => "File[#{title}.list]"
- })
- else
- should_not contain_apt__pin(title).with({
- "priority" => param_hash[:pin],
- "before" => "File[#{title}.list]"
- })
- end
- }
-
- it {
- should contain_exec("apt_update").with({
- "command" => "/usr/bin/apt-get update",
- "refreshonly" => true
- })
- }
-
- it {
- if param_hash[:required_packages]
- should contain_exec("Required packages: '#{param_hash[:required_packages]}' for #{title}").with({
- "command" => "/usr/bin/apt-get -y install #{param_hash[:required_packages]}",
- "subscribe" => "File[#{title}.list]",
- "refreshonly" => true,
- "before" => 'Exec[apt_update]',
- })
- else
- should_not contain_exec("Required packages: '#{param_hash[:required_packages]}' for #{title}").with({
- "command" => "/usr/bin/apt-get -y install #{param_hash[:required_packages]}",
- "subscribe" => "File[#{title}.list]",
- "refreshonly" => true
- })
- end
- }
-
- it {
- key_server = param_hash[:key_server] || nil
- key_content = param_hash[:key_content] || nil
- key_source = param_hash[:key_source] || nil
- if param_hash[:key]
- should contain_apt__key("Add key: #{param_hash[:key]} from Apt::Source #{title}").with({
- "key" => param_hash[:key],
- "ensure" => :present,
- "key_server" => key_server,
- "key_content" => key_content,
- "key_source" => key_source,
- "before" => "File[#{title}.list]"
- })
- else
- should_not contain_apt__key("Add key: #{param_hash[:key]} from Apt::Source #{title}").with({
- "key" => param_hash[:key],
- "ensure" => :present,
- "key_server" => param_hash[:key_server],
- "key_content" => param_hash[:key_content],
- "key_source" => param_hash[:key_source],
- "before" => "File[#{title}.list]"
- })
- end