Files
cookbook-openstack-common/spec/wrappers_spec.rb
Mark Vanderwiel 348aaf4033 Move role and recipe include methods to Common
These small wrappers are now needed by other cookbooks. They
provide a easy way to create a clean spec test.
Will put these into the Common openstack library module namespace
for easy use across the cookbooks.

Added common role defintion for compute worker.  Eventually all
the role definitions should be moved here.
Added new spec for these wrappers.

Change-Id: If548a9d63a42799e1401b18540878eca5ba2a0e1
Related-Bug: #1448255
2015-04-28 10:51:42 -05:00

30 lines
928 B
Ruby

# encoding: UTF-8
require_relative 'spec_helper'
require ::File.join ::File.dirname(__FILE__), '..', 'libraries', 'wrappers'
describe 'Openstack wrappers' do
let(:subject) { Object.new.extend(Openstack) }
describe '#recipe_included' do
it 'returns boolean for recipe list' do
node_hash = {
'recipes' => 'included_recipe'
}
allow(subject).to receive(:node).and_return(node_hash)
expect(subject.recipe_included?('included_recipe')).to be_truthy
expect(subject.recipe_included?('not_included_recipe')).to be_falsey
end
end
describe '#role_included' do
it 'returns boolean for role list' do
node_hash = {
'roles' => 'included_role'
}
allow(subject).to receive(:node).and_return(node_hash)
expect(subject.role_included?('included_role')).to be_truthy
expect(subject.role_included?('not_included_role')).to be_falsey
end
end
end