X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=spec%2Fdefines%2Fpin_spec.rb;h=a80ee6fa12387c5b60dbbf930f5b78eea2a3560f;hb=23ce10e3caa92eaf9b2bbc4b2a67838780e22dda;hp=a01a919a5b2e42636b49aa8a97460613a54f45ee;hpb=2b536b6a200e8f4f7f7ae37ec091abd06ca4cb70;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/spec/defines/pin_spec.rb b/spec/defines/pin_spec.rb index a01a919..a80ee6f 100644 --- a/spec/defines/pin_spec.rb +++ b/spec/defines/pin_spec.rb @@ -5,20 +5,19 @@ describe 'apt::pin', type: :define do end let(:facts) do { - os: { family: 'Debian', name: 'Debian', release: { major: '7', full: '7.0' } }, + os: { family: 'Debian', name: 'Debian', release: { major: '8', full: '8.0' } }, lsbdistid: 'Debian', osfamily: 'Debian', - lsbdistcodename: 'wheezy', - puppetversion: Puppet.version, + lsbdistcodename: 'jessie', } end let(:title) { 'my_pin' } - context 'defaults' do + context 'with defaults' do it { is_expected.to contain_apt__setting('pref-my_pin').with_content(%r{Explanation: : my_pin\nPackage: \*\nPin: release a=my_pin\nPin-Priority: 0\n}) } end - context 'set version' do + context 'with set version' do let :params do { 'packages' => 'vim', @@ -29,7 +28,7 @@ describe 'apt::pin', type: :define do it { is_expected.to contain_apt__setting('pref-my_pin').with_content(%r{Explanation: : my_pin\nPackage: vim\nPin: version 1\nPin-Priority: 0\n}) } end - context 'set origin' do + context 'with set origin' do let :params do { 'packages' => 'vim', @@ -40,7 +39,7 @@ describe 'apt::pin', type: :define do it { is_expected.to contain_apt__setting('pref-my_pin').with_content(%r{Explanation: : my_pin\nPackage: vim\nPin: origin test\nPin-Priority: 0\n}) } end - context 'not defaults' do + context 'without defaults' do let :params do { 'explanation' => 'foo', @@ -61,7 +60,7 @@ describe 'apt::pin', type: :define do } end - context 'ensure absent' do + context 'with ensure absent' do let :params do { 'ensure' => 'absent', @@ -73,14 +72,14 @@ describe 'apt::pin', type: :define do } end - context 'bad characters' do + context 'with bad characters' do let(:title) { 'such bad && wow!' } it { is_expected.to contain_apt__setting('pref-such__bad____wow_') } end describe 'validation' do - context 'invalid order' do + context 'with invalid order' do let :params do { 'order' => 'foo', @@ -88,13 +87,11 @@ describe 'apt::pin', type: :define do end it do - expect { - subject.call - }.to raise_error(Puppet::Error, %r{expects an Integer value, got String}) + is_expected.to raise_error(Puppet::Error, %r{expects an Integer value, got String}) end end - context 'packages == * and version' do + context 'with packages == * and version' do let :params do { 'version' => '1', @@ -102,13 +99,11 @@ describe 'apt::pin', type: :define do end it do - expect { - subject.call - }.to raise_error(Puppet::Error, %r{parameter version cannot be used in general form}) + is_expected.to raise_error(Puppet::Error, %r{parameter version cannot be used in general form}) end end - context 'packages == * and release and origin' do + context 'with packages == * and release and origin' do let :params do { 'origin' => 'test', @@ -117,13 +112,11 @@ describe 'apt::pin', type: :define do end it do - expect { - subject.call - }.to raise_error(Puppet::Error, %r{parameters release and origin are mutually exclusive}) + is_expected.to raise_error(Puppet::Error, %r{parameters release and origin are mutually exclusive}) end end - context 'specific form with release and origin' do + context 'with specific release and origin' do let :params do { 'release' => 'foo', @@ -133,13 +126,11 @@ describe 'apt::pin', type: :define do end it do - expect { - subject.call - }.to raise_error(Puppet::Error, %r{parameters release, origin, and version are mutually exclusive}) + is_expected.to raise_error(Puppet::Error, %r{parameters release, origin, and version are mutually exclusive}) end end - context 'specific form with version and origin' do + context 'with specific version and origin' do let :params do { 'version' => '1', @@ -149,9 +140,7 @@ describe 'apt::pin', type: :define do end it do - expect { - subject.call - }.to raise_error(Puppet::Error, %r{parameters release, origin, and version are mutually exclusive}) + is_expected.to raise_error(Puppet::Error, %r{parameters release, origin, and version are mutually exclusive}) end end end