Files
cookbook-openstack-common/spec/spec_helper.rb
Lance Albertson 8d07e9acee Cookstyle 6.19.5 fixes
Also remove unused database resources that somehow got imported in
https://review.opendev.org/701027.

Change-Id: I5241e0f1eb3bf44158bc64019a3880d83a6d4bdc
Depends-On: https://review.opendev.org/756168
Signed-off-by: Lance Albertson <lance@osuosl.org>
2020-10-05 17:02:11 -07:00

50 lines
1.1 KiB
Ruby

require 'chefspec'
require 'chefspec/berkshelf'
RSpec.configure do |config|
config.color = true
config.formatter = :documentation
config.log_level = :warn
end
UBUNTU_OPTS = {
platform: 'ubuntu',
version: '18.04',
}.freeze
REDHAT_OPTS = {
platform: 'redhat',
version: '7',
}.freeze
# We set a default platform for non-platform specific test cases
CHEFSPEC_OPTS = UBUNTU_OPTS
shared_context 'library-stubs' do
before do
allow(subject).to receive(:node).and_return(chef_run.node)
end
end
shared_context 'common-stubs' do
before do
allow_any_instance_of(Chef::Recipe).to receive(:search_for)
.with('os-identity').and_return(
[{
'openstack' => {
'identity' => {
'admin_tenant_name' => 'admin',
'admin_user' => 'admin',
},
},
}]
)
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('user', 'admin')
.and_return('admin')
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('user', 'admin-user-override')
.and_return('admin-user-override')
end
end