Fix deprecated method for rspec.

Also:
* add .gitignore for prevent to store temporary fixtures and
required modules
* enable some of puppet debug output to the test console

Fuel CI disabled, because unit-tests raun anyway, but
run deployment process not needed if changed only
test specs.

Fuel-CI: disable
Closes-bug: #1481861

Change-Id: Ie12942f00654572ac17199b6a50ef0a9525090ec
This commit is contained in:
Sergey Vasilenko
2015-08-05 20:17:42 +03:00
parent 347d51f391
commit 5729207dd6
3 changed files with 14 additions and 9 deletions

View File

@@ -0,0 +1 @@
spec/fixtures/*

View File

@@ -4,29 +4,29 @@ describe 'array_or_string_to_array' do
let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
it 'should exist' do
Puppet::Parser::Functions.function('array_or_string_to_array').should == 'function_array_or_string_to_array'
expect(Puppet::Parser::Functions.function('array_or_string_to_array')).to eq('function_array_or_string_to_array')
end
it 'should throw an error on invalid types' do
lambda {
expect {
scope.function_array_or_string_to_array([{:foo => :bar}])
}.should(raise_error(Puppet::ParseError))
}.to(raise_error(Puppet::ParseError))
end
it 'should throw an error on invalid arguments number' do
lambda {
expect {
scope.function_array_or_string_to_array([])
}.should(raise_error(Puppet::ParseError))
lambda {
}.to(raise_error(Puppet::ParseError))
expect {
scope.function_array_or_string_to_array([[1,2],[3,4]])
}.should(raise_error(Puppet::ParseError))
}.to(raise_error(Puppet::ParseError))
end
it 'should return array if given array' do
scope.function_array_or_string_to_array([[1,2,3,4,5,6,7,8,9]]).should == [1,2,3,4,5,6,7,8,9]
expect(scope.function_array_or_string_to_array([[1,2,3,4,5,6,7,8,9]])).to eq([1,2,3,4,5,6,7,8,9])
end
it 'should return array of strings if given string with separators' do
scope.function_array_or_string_to_array(['1,2,3,4,5:6,7 8,9']).should == ['1','2','3','4','5','6','7','8','9']
expect(scope.function_array_or_string_to_array(['1,2,3,4,5:6,7 8,9'])).to eq(['1','2','3','4','5','6','7','8','9'])
end
end

View File

@@ -13,7 +13,11 @@ if Puppet.version < '4.0.0'
end
end
Puppet::Util::Log.level = :debug
Puppet::Util::Log.newdestination(:console)
RSpec.configure do |c|
c.module_path = File.join(fixture_path, 'modules')
c.manifest_dir = File.join(fixture_path, 'manifests')
c.mock_with(:mocha)
end