1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
# frozen_string_literal: true
require 'spec_helper'
describe RSpec::Puppet::FunctionExampleGroup::V4FunctionWrapper do
let(:name) { 'test_function' }
let(:func) { double('func') }
let(:global_scope) { double('global_scope') }
let(:overrides) { { global_scope: global_scope } }
describe 'when calling with params' do
subject { described_class.new(name, func, overrides) }
it do
expect(func).to receive(:call).with(global_scope, 1, 2).once
subject.call({}, 1, 2)
end
end
describe 'when executing with params' do
subject { described_class.new(name, func, overrides) }
it do
expect(func).to receive(:call).with(global_scope, 1, 2).once
subject.execute(1, 2)
end
end
end
describe RSpec::Puppet::FunctionExampleGroup::V3FunctionWrapper do
let(:name) { 'test_function' }
let(:func) { double('func') }
describe 'when calling with params' do
subject { described_class.new(name, func) }
it do
expect(func).to receive(:call).with([1, 2]).once
subject.call([1, 2])
end
end
describe 'when executing with params' do
subject { described_class.new(name, func) }
it do
expect(func).to receive(:call).with([1, 2]).once
subject.execute(1, 2)
end
end
end
|