1 require 'spec_helper_acceptance'
3 describe 'fqdn_rotate function' do
5 include_context 'with faked facts'
6 context "when the FQDN is 'fakehost.localdomain'" do
8 fake_fact('fqdn', 'fakehost.localdomain')
12 $a = ['a','b','c','d']
14 notice(inline_template('fqdn_rotate is <%= @o.inspect %>'))
16 it 'rotates arrays' do
17 apply_manifest(pp1, :catch_failures => true) do |r|
18 expect(r.stdout).to match(%r{fqdn_rotate is \["d", "a", "b", "c"\]})
23 $a = ['a','b','c','d']
25 $o = fqdn_rotate($a, $s)
26 notice(inline_template('fqdn_rotate is <%= @o.inspect %>'))
28 it 'rotates arrays with custom seeds' do
29 apply_manifest(pp2, :catch_failures => true) do |r|
30 expect(r.stdout).to match(%r{fqdn_rotate is \["c", "d", "a", "b"\]})
37 notice(inline_template('fqdn_rotate is <%= @o.inspect %>'))
39 it 'rotates strings' do
40 apply_manifest(pp3, :catch_failures => true) do |r|
41 expect(r.stdout).to match(%r{fqdn_rotate is "dabc"})
48 $o = fqdn_rotate($a, $s)
49 notice(inline_template('fqdn_rotate is <%= @o.inspect %>'))
51 it 'rotates strings with custom seeds' do
52 apply_manifest(pp4, :catch_failures => true) do |r|
53 expect(r.stdout).to match(%r{fqdn_rotate is "cdab"})
59 it 'handles improper argument counts'
60 it 'handles invalid arguments'