
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) * Remove un-used puppet-lint (name_containing_dash config) Change-Id: I5488507176d4665895eef65ddb4b6f0fb4eda3e7 Card: https://trello.com/c/eHXc1Ryd/4-investigate-the-necessary-change-to-be-rspec-puppet-2-0-0-compliant
52 lines
1.3 KiB
Ruby
52 lines
1.3 KiB
Ruby
require 'spec_helper'
|
|
describe 'swift::ringbuilder::create' do
|
|
|
|
let :default_params do
|
|
{:part_power => 18,
|
|
:replicas => 3,
|
|
:min_part_hours => 24}
|
|
end
|
|
|
|
describe 'with allowed titles' do
|
|
['object', 'container', 'account'].each do |type|
|
|
describe "when title is #{type}" do
|
|
let :title do
|
|
type
|
|
end
|
|
|
|
[{},
|
|
{:part_power => 19,
|
|
:replicas => 6,
|
|
:min_part_hours => 2}].each do |param_set|
|
|
|
|
describe "when #{param_set == {} ? "using default" : "specifying"} class parame
|
|
ters" do
|
|
let :param_hash do
|
|
default_params.merge(param_set)
|
|
end
|
|
|
|
let :params do
|
|
param_set
|
|
end
|
|
|
|
it { is_expected.to contain_exec("create_#{type}").with(
|
|
{:command => "swift-ring-builder /etc/swift/#{type}.builder create #{param_hash[:part_power]} #{param_hash[:replicas]} #{param_hash[:min_part_hours]}",
|
|
:path => '/usr/bin',
|
|
:creates => "/etc/swift/#{type}.builder" }
|
|
)}
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
describe 'with an invalid title' do
|
|
let :title do
|
|
'invalid'
|
|
end
|
|
it 'should raise an error' do
|
|
expect { catalogue }.to raise_error(Puppet::Error)
|
|
end
|
|
end
|
|
|
|
end
|