X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;ds=sidebyside;f=spec%2Fdefines%2Fpin_spec.rb;h=a4cb1e26e3ad74f0ef67a58b52af2f9119278aa9;hb=2e206e31e4f01bd127cfebc7ee36cf5fd72def22;hp=cd269d3b8bb11b3deff3831df99be63b5d877da8;hpb=40f875521715759eddab7315f6d51e6519f016d8;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/spec/defines/pin_spec.rb b/spec/defines/pin_spec.rb index cd269d3..a4cb1e2 100644 --- a/spec/defines/pin_spec.rb +++ b/spec/defines/pin_spec.rb @@ -12,34 +12,77 @@ describe 'apt::pin', :type => :define do } end - [ {}, + [ + { :params => {}, + :content => "# my_pin\nExplanation: : my_pin\nPackage: *\nPin: release a=my_pin\nPin-Priority: 0\n" + }, { - :packages => 'apache', - :priority => '1' + :params => { + :packages => 'apache', + :priority => '1' + }, + :content => "# my_pin\nExplanation: : my_pin\nPackage: apache\nPin: release a=my_pin\nPin-Priority: 1\n" }, { - :order => 50, - :packages => 'apache', - :priority => '1' + :params => { + :order => 50, + :packages => 'apache', + :priority => '1' + }, + :content => "# my_pin\nExplanation: : my_pin\nPackage: apache\nPin: release a=my_pin\nPin-Priority: 1\n" }, { - :ensure => 'absent', - :packages => 'apache', - :priority => '1' + :params => { + :ensure => 'absent', + :packages => 'apache', + :priority => '1' + }, + :content => "# my_pin\nExplanation: : my_pin\nPackage: apache\nPin: release a=my_pin\nPin-Priority: 1\n" }, { - :packages => 'apache', - :priority => '1', - :release => 'my_newpin' - } + :params => { + :packages => 'apache', + :priority => '1', + :release => 'my_newpin' + }, + :content => "# my_pin\nExplanation: : my_pin\nPackage: apache\nPin: release a=my_newpin\nPin-Priority: 1\n" + }, + { + :params => { + :packages => 'apache', + :priority => '1', + :version => '2.2.16*' + }, + :content => "# my_pin\nExplanation: : my_pin\nPackage: apache\nPin: version 2.2.16*\nPin-Priority: 1\n" + }, + { + :params => { + :priority => '1', + :origin => 'ftp.de.debian.org' + }, + :content => "# my_pin\nExplanation: : my_pin\nPackage: *\nPin: origin \"ftp.de.debian.org\"\nPin-Priority: 1\n" + }, + { + :params => { + :packages => 'apache', + :priority => '1', + :release => 'stable', + :codename => 'wheezy', + :release_version => '3.0', + :component => 'main', + :originator => 'Debian', + :label => 'Debian' + }, + :content => "# my_pin\nExplanation: : my_pin\nPackage: apache\nPin: release a=stable, n=wheezy, v=3.0, c=main, o=Debian, l=Debian\nPin-Priority: 1\n" + }, ].each do |param_set| describe "when #{param_set == {} ? "using default" : "specifying"} define parameters" do let :param_hash do - default_params.merge(param_set) + default_params.merge(param_set[:params]) end let :params do - param_set + param_set[:params] end it { should include_class("apt::params") } @@ -50,7 +93,7 @@ describe 'apt::pin', :type => :define do 'owner' => 'root', 'group' => 'root', 'mode' => '0644', - 'content' => "# #{title}\nPackage: #{param_hash[:packages]}\nPin: release a=#{param_hash[:release] || title}\nPin-Priority: #{param_hash[:priority]}\n", + 'content' => param_set[:content], }) } end