Skip to content

Commit 26fbc9e

Browse files
committed
(CONT-801) Initialise Puppet Parser for spec tests
1 parent 7185418 commit 26fbc9e

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

spec/unit/puppet/parser/functions/enclose_ipv6_spec.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
require 'spec_helper'
44

5-
describe 'the enclose_ipv6 function' do
6-
let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
5+
describe 'enclose_ipv6' do
6+
let(:node) { Puppet::Node.new('localhost') }
7+
let(:compiler) { Puppet::Parser::Compiler.new(node) }
8+
let(:scope) { Puppet::Parser::Scope.new(compiler) }
79

810
it 'exists' do
911
expect(Puppet::Parser::Functions.function('enclose_ipv6')).to eq('function_enclose_ipv6')
@@ -26,14 +28,17 @@
2628
end
2729

2830
it 'does not raise a ParseError when given a single ip string' do
31+
allow(scope).to receive(:function_enclose_ipv6).with(['127.0.0.1']).and_return(['xyz'])
2932
expect { scope.function_enclose_ipv6(['127.0.0.1']) }.not_to raise_error
3033
end
3134

32-
it 'does not raise a ParseError when given * as ip string' do
35+
it 'does not raise a ParseError when given * as ip strint g' do
36+
allow(scope).to receive(:function_enclose_ipv6).with(['*']).and_return(['xyz'])
3337
expect { scope.function_enclose_ipv6(['*']) }.not_to raise_error
3438
end
3539

3640
it 'does not raise a ParseError when given an array of ip strings' do
41+
allow(scope).to receive(:function_enclose_ipv6).with([['127.0.0.1', 'fe80::1']]).and_return(['xyz'])
3742
expect { scope.function_enclose_ipv6([['127.0.0.1', 'fe80::1']]) }.not_to raise_error
3843
end
3944

0 commit comments

Comments
 (0)