X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=spec%2Fdefines%2Fpin_spec.rb;h=1b6ac33c28f629eac360d7468114c08ab8b9a39f;hb=7e31732abd277c852564c10011099bdf6967dc4f;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..1b6ac33 100644 --- a/spec/defines/pin_spec.rb +++ b/spec/defines/pin_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apt::pin', type: :define do let :pre_condition do @@ -5,20 +7,27 @@ describe 'apt::pin', type: :define do end let(:facts) do { - os: { family: 'Debian', name: 'Debian', release: { major: '7', full: '7.0' } }, - lsbdistid: 'Debian', - osfamily: 'Debian', - lsbdistcodename: 'wheezy', - puppetversion: Puppet.version, + os: { + family: 'Debian', + name: 'Debian', + release: { + major: '8', + full: '8.0', + }, + distro: { + codename: 'jessie', + id: 'Debian', + }, + }, } 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 +38,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 +49,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 +70,7 @@ describe 'apt::pin', type: :define do } end - context 'ensure absent' do + context 'with ensure absent' do let :params do { 'ensure' => 'absent', @@ -73,14 +82,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 +97,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 +109,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 +122,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 +136,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 +150,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