-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathvars_spec.rb
More file actions
33 lines (27 loc) · 892 Bytes
/
vars_spec.rb
File metadata and controls
33 lines (27 loc) · 892 Bytes
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
# frozen_string_literal: true
require 'spec_helper'
require 'bolt/executor'
require 'bolt/inventory'
describe 'vars' do
let(:executor) { Bolt::Executor.new }
let(:inventory) { Bolt::Inventory.empty }
let(:hostname) { 'example' }
let(:target) { inventory.get_target(hostname) }
around(:each) do |example|
Puppet[:tasks] = true
Puppet.override(bolt_executor: executor, bolt_inventory: inventory) do
example.run
end
end
it 'should return an empty hash if no vars are set' do
is_expected.to run.with_params(target).and_return({})
end
it 'should return a hash of vars' do
inventory.set_var(target, 'a' => 'b')
is_expected.to run.with_params(target).and_return('a' => 'b')
end
it 'reports the call to analytics' do
executor.expects(:report_function_call).with('vars')
is_expected.to run.with_params(target).and_return({})
end
end