require 'spec_helper'

describe 'yum_test::test_globalconfig_one' do
  let(:test_global_config_one_run) do
    ChefSpec::Runner.new(
      :step_into => 'yum_globalconfig'
      ).converge(described_recipe)
  end

  let(:test_globalconfig_one_content) do
    '# This file was generated by Chef
# Do NOT modify this file by hand.

[main]
cachedir=/var/cache/yum/$basearch/$releasever
debuglevel=2
exactarch=1
gpgcheck=1
installonly_limit=3
keepcache=0
logfile=/var/log/yum.log
obsoletes=1
plugins=1'
  end

  context 'creating a yum_globalconfig with minimal parameters' do
    it 'creates yum_globalconfig[/tmp/yum.conf]' do
      expect(test_global_config_one_run).to create_yum_globalconfig('/tmp/yum.conf')
    end

    it 'steps into yum_globalconfig and creates template[/tmp/yum.conf]' do
      expect(test_global_config_one_run).to create_template('/tmp/yum.conf')
    end

    it 'steps into yum_globalconfig and renders file[/tmp/yum.conf]' do
      expect(test_global_config_one_run).to render_file('/tmp/yum.conf').with_content(test_globalconfig_one_content)
    end
  end
end
