098c4b855e
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 order to be prepared for rspec 3.x move. In details: * Upgrade and pin rspec-puppet from 1.0.1 to 2.0.0 * 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 * Clean Gemfile (remove over-specificication of runtime deps of puppetlabs_spec_helper) Change-Id: Ifbfcc86d2afa8a704710b3ed40957f2ff8167364 Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
32 lines
989 B
Ruby
32 lines
989 B
Ruby
require 'puppet'
|
|
require 'puppet/type/tempest_glance_id_setter'
|
|
|
|
describe 'Puppet::Type.type(:tempest_glance_id_setter)' do
|
|
it 'should require a name' do
|
|
expect {
|
|
Puppet::Type.type(:tempest_glance_id_setter).new({})
|
|
}.to raise_error(Puppet::Error, 'Title or name must be provided')
|
|
end
|
|
|
|
before :each do
|
|
@tempest_glance_id_setter = Puppet::Type.type(:tempest_glance_id_setter).new(
|
|
:name => 'foo',
|
|
:tempest_conf_path => '/tmp/tempest.conf',
|
|
:image_name => 'image')
|
|
|
|
end
|
|
|
|
it 'should accept valid ensure values' do
|
|
@tempest_glance_id_setter[:ensure] = :present
|
|
expect(@tempest_glance_id_setter[:ensure]).to eq(:present)
|
|
@tempest_glance_id_setter[:ensure] = :absent
|
|
expect(@tempest_glance_id_setter[:ensure]).to eq(:absent)
|
|
end
|
|
|
|
it 'should not accept invalid ensure values' do
|
|
expect {
|
|
@tempest_glance_id_setter[:ensure] = :installed
|
|
}.to raise_error(Puppet::Error, /Invalid value/)
|
|
end
|
|
end
|