X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=spec%2Fdefines%2Fsource_spec.rb;h=d9627172be7945275eab6ff31670cad3154d9294;hb=f78c7a2b93b83afebff5b4ead4eadfea3b187403;hp=798279e6b26297787fe5e03c053ac15e24df7257;hpb=4513a5845c2a18aece7e17ad82612ec4da3efaa0;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/spec/defines/source_spec.rb b/spec/defines/source_spec.rb index 798279e..d962717 100644 --- a/spec/defines/source_spec.rb +++ b/spec/defines/source_spec.rb @@ -3,16 +3,9 @@ require 'spec_helper' describe 'apt::source' do - GPG_KEY_ID = '6F6B15509CF8E59E6E469F327F438280EF8D349F' - - let :pre_condition do - 'class { "apt": }' - end - - let :title do - 'my_source' - end - + let(:id) { '6F6B15509CF8E59E6E469F327F438280EF8D349F' } + let(:title) { 'my_source' } + let(:pre_condition) { 'class { "apt": }' } let :facts do { os: { @@ -20,13 +13,13 @@ describe 'apt::source' do name: 'Debian', release: { major: '9', - full: '9.0', + full: '9.0' }, distro: { codename: 'stretch', - id: 'Debian', - }, - }, + id: 'Debian' + } + } } end @@ -54,7 +47,7 @@ describe 'apt::source' do location: 'hello.there', pin: { 'release' => 'wishwash', 'explanation' => 'wishwash', - 'priority' => 1001 }, + 'priority' => 1001 } } end @@ -79,10 +72,10 @@ describe 'apt::source' do location: 'http://debian.mirror.iweb.ca/debian/', release: 'sid', repos: 'testing', - key: GPG_KEY_ID, + key: id, pin: '10', architecture: 'x86_64', - allow_unsigned: true, + allow_unsigned: true } end @@ -98,8 +91,8 @@ describe 'apt::source' do } it { - expect(subject).to contain_apt__key("Add key: #{GPG_KEY_ID} from Apt::Source my_source").that_comes_before('Apt::Setting[list-my_source]').with(ensure: 'present', - id: GPG_KEY_ID) + expect(subject).to contain_apt__key("Add key: #{id} from Apt::Source my_source").that_comes_before('Apt::Setting[list-my_source]').with(ensure: 'present', + id: id) } end @@ -112,15 +105,15 @@ describe 'apt::source' do repos: 'testing', key: { 'ensure' => 'refreshed', - 'id' => GPG_KEY_ID, + 'id' => id, 'server' => 'pgp.mit.edu', 'content' => 'GPG key content', 'source' => 'http://apt.puppetlabs.com/pubkey.gpg', - 'weak_ssl' => true, + 'weak_ssl' => true }, pin: '10', architecture: 'x86_64', - allow_unsigned: true, + allow_unsigned: true } end @@ -136,12 +129,12 @@ describe 'apt::source' do } it { - expect(subject).to contain_apt__key("Add key: #{GPG_KEY_ID} from Apt::Source my_source").that_comes_before('Apt::Setting[list-my_source]').with(ensure: 'refreshed', - id: GPG_KEY_ID, - server: 'pgp.mit.edu', - content: 'GPG key content', - source: 'http://apt.puppetlabs.com/pubkey.gpg', - weak_ssl: true) + expect(subject).to contain_apt__key("Add key: #{id} from Apt::Source my_source").that_comes_before('Apt::Setting[list-my_source]').with(ensure: 'refreshed', + id: id, + server: 'pgp.mit.edu', + content: 'GPG key content', + source: 'http://apt.puppetlabs.com/pubkey.gpg', + weak_ssl: true) } end end @@ -150,7 +143,7 @@ describe 'apt::source' do let :params do { location: 'hello.there', - allow_insecure: true, + allow_insecure: true } end @@ -163,7 +156,7 @@ describe 'apt::source' do let :params do { location: 'hello.there', - allow_unsigned: true, + allow_unsigned: true } end @@ -176,7 +169,7 @@ describe 'apt::source' do let :params do { location: 'hello.there', - check_valid_until: false, + check_valid_until: false } end @@ -189,7 +182,7 @@ describe 'apt::source' do let :params do { location: 'hello.there', - check_valid_until: true, + check_valid_until: true } end @@ -202,7 +195,7 @@ describe 'apt::source' do let :params do { location: 'hello.there', - keyring: '/usr/share/keyrings/foo-archive-keyring.gpg', + keyring: '/usr/share/keyrings/foo-archive-keyring.gpg' } end @@ -219,7 +212,7 @@ describe 'apt::source' do location: 'hello.there', architecture: 'amd64', allow_unsigned: true, - keyring: '/usr/share/keyrings/foo-archive-keyring.gpg', + keyring: '/usr/share/keyrings/foo-archive-keyring.gpg' } end @@ -234,7 +227,7 @@ describe 'apt::source' do let :params do { location: 'HTTPS://foo.bar', - allow_unsigned: false, + allow_unsigned: false } end @@ -251,21 +244,21 @@ describe 'apt::source' do name: 'Debian', release: { major: '9', - full: '9.0', + full: '9.0' }, distro: { codename: 'stretch', - id: 'Debian', - }, + id: 'Debian' + } }, - puppetversion: Puppet.version, + puppetversion: Puppet.version } end let :params do { location: 'HTTPS://foo.bar', allow_unsigned: false, - release: 'customrelease', + release: 'customrelease' } end @@ -282,19 +275,19 @@ describe 'apt::source' do name: 'Debian', release: { major: '10', - full: '10.0', + full: '10.0' }, distro: { codename: 'buster', - id: 'Debian', - }, - }, + id: 'Debian' + } + } } end let :params do { location: 'https://foo.bar', - allow_unsigned: false, + allow_unsigned: false } end @@ -311,20 +304,20 @@ describe 'apt::source' do name: 'Debian', release: { major: '7', - full: '7.0', + full: '7.0' }, distro: { codename: 'wheezy', - id: 'Debian', - }, - }, + id: 'Debian' + } + } } end let :params do { location: 'hello.there', include: { 'deb' => false, 'src' => true }, - architecture: 'x86_64', + architecture: 'x86_64' } end @@ -340,7 +333,7 @@ describe 'apt::source' do let :params do { location: 'hello.there', - include: { 'deb' => false, 'src' => true }, + include: { 'deb' => false, 'src' => true } } end @@ -353,7 +346,7 @@ describe 'apt::source' do let :params do { location: 'hello.there', - include: { 'src' => true }, + include: { 'src' => true } } end @@ -366,7 +359,7 @@ describe 'apt::source' do let :params do { include: { 'deb' => false }, - location: 'hello.there', + location: 'hello.there' } end @@ -381,7 +374,7 @@ describe 'apt::source' do let :params do { include: { 'deb' => false, 'src' => true }, - location: 'hello.there', + location: 'hello.there' } end @@ -395,7 +388,7 @@ describe 'apt::source' do context 'with ensure => absent' do let :params do { - ensure: 'absent', + ensure: 'absent' } end @@ -413,12 +406,12 @@ describe 'apt::source' do name: 'Debian', release: { major: '8', - full: '8.0', + full: '8.0' }, distro: { - id: 'Debian', - }, - }, + id: 'Debian' + } + } } end let(:params) { { location: 'hello.there' } } @@ -438,7 +431,7 @@ describe 'apt::source' do let :params do { location: 'hello.there', - pin: true, + pin: true } end @@ -450,7 +443,7 @@ describe 'apt::source' do context 'with notify_update = undef (default)' do let :params do { - location: 'hello.there', + location: 'hello.there' } end @@ -461,7 +454,7 @@ describe 'apt::source' do let :params do { location: 'hello.there', - notify_update: true, + notify_update: true } end @@ -472,7 +465,7 @@ describe 'apt::source' do let :params do { location: 'hello.there', - notify_update: false, + notify_update: false } end