puppet-glance/spec/classes/glance_notify_qpid_spec.rb
Sebastien Badia dbe297b056 spec: updates for rspec-puppet 2.x and rspec 3.x
This patch aim to update our specs test in order to work with the rspec-puppet release
2.0.0, in the mean time, we update rspec syntax in order to be prepared
for rspec 3.x move.

In details:

  * Use shared_examples "a Puppet::Error" for puppet::error tests
  * Convert 'should' keyword to 'is_expected.to' (prepare rspec 3.x)
  * Fix spec tests for rspec-puppet 2.0.0
  * Upgrade and pin rspec-puppet from 1.0.1 to 2.0.0
  * Clean Gemfile (remove over-specificication of runtime deps of puppetlabs_spec_helper)

Change-Id: Ibd0333dc3c0959e846edfbad51fb48e8dfb8fbe9
Card: https://trello.com/c/eHXc1Ryd/4-investigate-the-necessary-change-to-be-rspec-puppet-2-0-0-compliant
2015-02-25 05:37:44 +01:00

58 lines
2.3 KiB
Ruby

require 'spec_helper'
describe 'glance::notify::qpid' do
let :facts do
{
:osfamily => 'Debian'
}
end
let :pre_condition do
'class { "glance::api": keystone_password => "pass" }'
end
describe 'when default params and qpid_password' do
let :params do
{:qpid_password => 'pass'}
end
it { is_expected.to contain_glance_api_config('DEFAULT/notifier_driver').with_value('qpid') }
it { is_expected.to contain_glance_api_config('DEFAULT/qpid_username').with_value('guest') }
it { is_expected.to contain_glance_api_config('DEFAULT/qpid_password').with_value('pass') }
it { is_expected.to contain_glance_api_config('DEFAULT/qpid_password').with_value(params[:qpid_password]).with_secret(true) }
it { is_expected.to contain_glance_api_config('DEFAULT/qpid_hostname').with_value('localhost') }
it { is_expected.to contain_glance_api_config('DEFAULT/qpid_port').with_value('5672') }
it { is_expected.to contain_glance_api_config('DEFAULT/qpid_protocol').with_value('tcp') }
end
describe 'when passing params' do
let :params do
{
:qpid_password => 'pass2',
:qpid_username => 'guest2',
:qpid_hostname => 'localhost2',
:qpid_port => '5673'
}
end
it { is_expected.to contain_glance_api_config('DEFAULT/qpid_username').with_value('guest2') }
it { is_expected.to contain_glance_api_config('DEFAULT/qpid_hostname').with_value('localhost2') }
it { is_expected.to contain_glance_api_config('DEFAULT/qpid_port').with_value('5673') }
it { is_expected.to contain_glance_api_config('DEFAULT/qpid_protocol').with_value('tcp') }
end
describe 'when configuring with ssl' do
let :params do
{
:qpid_password => 'pass3',
:qpid_username => 'guest3',
:qpid_hostname => 'localhost3',
:qpid_port => '5671',
:qpid_protocol => 'ssl'
}
end
it { is_expected.to contain_glance_api_config('DEFAULT/qpid_username').with_value('guest3') }
it { is_expected.to contain_glance_api_config('DEFAULT/qpid_hostname').with_value('localhost3') }
it { is_expected.to contain_glance_api_config('DEFAULT/qpid_port').with_value('5671') }
it { is_expected.to contain_glance_api_config('DEFAULT/qpid_protocol').with_value('ssl') }
end
end