Project

General

Profile

« Previous | Next » 

Revision 85b0dee0

Added by Michael Moll about 8 years ago

modernize deprecated rspec syntax

Closes GH-415

View differences:

spec/functions/ensure_value_in_string_spec.rb
let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
it 'should exist' do
Puppet::Parser::Functions.function('ensure_value_in_string').should == 'function_ensure_value_in_string'
expect(Puppet::Parser::Functions.function('ensure_value_in_string')).to eq 'function_ensure_value_in_string'
end
it 'should throw an error with bad number of arguments' do
......
end
it 'should append values to the end' do
scope.function_ensure_value_in_string(['one,two', ['three']]).should eq('one,two,three')
expect(scope.function_ensure_value_in_string(['one,two', ['three']])).to eq 'one,two,three'
end
it 'should append values to the end in same order' do
scope.function_ensure_value_in_string(['one,two', ['three', 'four']]).should eq('one,two,three,four')
expect(scope.function_ensure_value_in_string(['one,two', ['three', 'four']])).to eq 'one,two,three,four'
end
it 'should not append values existing in original string' do
scope.function_ensure_value_in_string(['one,two', ['two', 'three']]).should eq('one,two,three')
scope.function_ensure_value_in_string(['one,two', ['one', 'three']]).should eq('one,two,three')
scope.function_ensure_value_in_string(['one,two', ['one', 'two']]).should eq('one,two')
expect(scope.function_ensure_value_in_string(['one,two', ['two', 'three']])).to eq 'one,two,three'
expect(scope.function_ensure_value_in_string(['one,two', ['one', 'three']])).to eq 'one,two,three'
expect(scope.function_ensure_value_in_string(['one,two', ['one', 'two']])).to eq 'one,two'
end
it 'should append even to empty strings' do
scope.function_ensure_value_in_string(['', ['two', 'three']]).should eq('two,three')
expect(scope.function_ensure_value_in_string(['', ['two', 'three']])).to eq 'two,three'
end
it 'should append even empty array' do
scope.function_ensure_value_in_string(['one,two', []]).should eq('one,two')
expect(scope.function_ensure_value_in_string(['one,two', []])).to eq 'one,two'
end
it 'should not allow using wrong types and undefined values' do
......
end
it 'should ignore whitespaces but preserve it' do
scope.function_ensure_value_in_string(['one, two, three , four', ['five']]).should eq('one, two, three , four,five')
expect(scope.function_ensure_value_in_string(['one, two, three , four', ['five']])).to eq 'one, two, three , four,five'
end
it 'should accept third argument as a custom separator' do
scope.function_ensure_value_in_string(['one,two', ['two', 'three'], ', ']).should eq('one,two, three')
expect(scope.function_ensure_value_in_string(['one,two', ['two', 'three'], ', '])).to eq 'one,two, three'
end
end

Also available in: Unified diff