Skip to content

Commit 560ebcd

Browse files
committed
Merge pull request #6 from chef-cookbooks/jtimberman/refactor-tests
Refactor the specs for DRY and simplicity
2 parents 15fcbae + 904d13e commit 560ebcd

7 files changed

+289
-344
lines changed

spec/centos_65_spec.rb

-172
This file was deleted.

spec/ubuntu_1404_spec.rb

-172
This file was deleted.

spec/unit/README.md

Whitespace-only changes.

spec/unit/metadata.rb

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
name 'FC045-not-a-cookbook'

spec/unit/recipes/test_local_spec.rb

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
require 'spec_helper'
2+
3+
describe 'test::local' do
4+
context 'on centos' do
5+
cached(:centos_65) do
6+
ChefSpec::SoloRunner.new(
7+
platform: 'centos',
8+
version: '6.5',
9+
step_into: %w(chef_ingredient chef_server_ingredient)
10+
) do |node|
11+
node.set['chef-server-core']['version'] = nil
12+
end.converge(described_recipe)
13+
end
14+
15+
it 'uses the rpm_package provider instead of yum_package' do
16+
expect(centos_65).to install_rpm_package('chef-server-core')
17+
expect(centos_65).to_not install_yum_package('chef-server-core')
18+
end
19+
end
20+
21+
context 'on ubuntu' do
22+
cached(:ubuntu_1404) do
23+
ChefSpec::SoloRunner.new(
24+
platform: 'ubuntu',
25+
version: '14.04',
26+
step_into: %w(chef_ingredient chef_server_ingredient)
27+
) do |node|
28+
node.set['chef-server-core']['version'] = nil
29+
end.converge(described_recipe)
30+
end
31+
32+
it 'uses the dpkg_package provider instead of apt_package' do
33+
expect(ubuntu_1404).to install_dpkg_package('chef-server-core')
34+
expect(ubuntu_1404).to_not install_apt_package('chef-server-core')
35+
end
36+
end
37+
end
File renamed without changes.

0 commit comments

Comments
 (0)