From c41567b14773de20c72204c5bce9e55e5210944c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathieu=20Gagne=CC=81?= Date: Thu, 30 Jan 2014 17:56:30 -0500 Subject: [PATCH] Cleanup rspec tests of nova::objectstore Change-Id: If97f057248d863077b5791af70342b75ec7d1b62 --- spec/classes/nova_objectstore_spec.rb | 52 +++++++-------------------- 1 file changed, 13 insertions(+), 39 deletions(-) diff --git a/spec/classes/nova_objectstore_spec.rb b/spec/classes/nova_objectstore_spec.rb index b78a994b0..5f1a1d386 100644 --- a/spec/classes/nova_objectstore_spec.rb +++ b/spec/classes/nova_objectstore_spec.rb @@ -6,51 +6,25 @@ describe 'nova::objectstore' do 'include nova' end - describe 'on debian platforms' do + context 'on Debian platforms' do let :facts do { :osfamily => 'Debian' } end - it { should contain_service('nova-objectstore').with( - 'name' => 'nova-objectstore', - 'ensure' => 'stopped', - 'hasstatus' => true, - 'enable' => false - )} - it { should contain_package('nova-objectstore').with( - 'name' => 'nova-objectstore', - 'ensure' => 'present', - 'notify' => 'Service[nova-objectstore]' - ) } - describe 'with enabled as true' do - let :params do - {:enabled => true} - end - it { should contain_service('nova-objectstore').with( - 'name' => 'nova-objectstore', - 'ensure' => 'running', - 'hasstatus' => true, - 'enable' => true - )} - end - describe 'with package version' do - let :params do - {:ensure_package => '2012.1-2'} - end - it { should contain_package('nova-objectstore').with( - 'ensure' => '2012.1-2' - )} - end + + it_behaves_like 'generic nova service', { + :name => 'nova-objectstore', + :package_name => 'nova-objectstore', + :service_name => 'nova-objectstore' } end - describe 'on rhel' do + + context 'on RedHat platforms' do let :facts do { :osfamily => 'RedHat' } end - it { should contain_service('nova-objectstore').with( - 'name' => 'openstack-nova-objectstore', - 'ensure' => 'stopped', - 'hasstatus' => true, - 'enable' => false - )} - it { should contain_package('nova-objectstore').with_name('openstack-nova-objectstore') } + + it_behaves_like 'generic nova service', { + :name => 'nova-objectstore', + :package_name => 'openstack-nova-objectstore', + :service_name => 'openstack-nova-objectstore' } end end