2 # Cookbook Name:: apt_utils
3 # Recipe Spec:: source_spec
5 # Copyright 2015, whitestar
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
20 require_relative '../spec_helper'
22 describe 'apt_utils::source' do
23 let(:chef_run_on_non_debian) {
25 .new(platform: 'centos', version: '7.0')
26 .converge(described_recipe)
29 it 'does nothing on non debian family.' do
30 expect(chef_run_on_non_debian).to_not render_file('/etc/apt/sources.list')
33 let(:chef_run_on_debian) {
34 ChefSpec::SoloRunner.new(platform: 'debian', version: '8.1') {|node|
35 node.set['apt_utils']['source']['apt_lines'] = [
36 'deb http://cdn.debian.net/debian jessie main contrib non-free',
37 'deb http://cdn.debian.net/debian jessie-updates main contrib',
39 }.converge(described_recipe)
42 it 'renders /etc/apt/sources.list on debian family.' do
43 expected = expect(chef_run_on_debian)
44 expected.to render_file('/etc/apt/sources.list')
45 .with_content('deb http://cdn.debian.net/debian jessie main contrib non-free')
46 expected.to render_file('/etc/apt/sources.list')
47 .with_content('deb http://cdn.debian.net/debian jessie-updates main contrib')