1 #! /usr/bin/env ruby -S rspec
2 require 'spec_helper_acceptance'
4 describe 'has_interface_with function', :unless => ((UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem'))) or (fact('osfamily') == 'windows') or (fact('osfamily') == 'AIX')) do
6 it 'has_interface_with existing ipaddress' do
9 $o = has_interface_with('ipaddress', $a)
10 notice(inline_template('has_interface_with is <%= @o.inspect %>'))
13 apply_manifest(pp, :catch_failures => true) do |r|
14 expect(r.stdout).to match(/has_interface_with is true/)
17 it 'has_interface_with absent ipaddress' do
20 $o = has_interface_with('ipaddress', $a)
21 notice(inline_template('has_interface_with is <%= @o.inspect %>'))
24 apply_manifest(pp, :catch_failures => true) do |r|
25 expect(r.stdout).to match(/has_interface_with is false/)
28 it 'has_interface_with existing interface' do
30 if $osfamily == 'Solaris' or $osfamily == 'Darwin' {
32 }elsif $osfamily == 'windows' {
33 $a = $::kernelmajversion ? {
34 /6\.(2|3|4)/ => 'Ethernet0',
35 /6\.(0|1)/ => 'Local_Area_Connection',
36 /5\.(1|2)/ => undef, #Broken current in facter
41 $o = has_interface_with($a)
42 notice(inline_template('has_interface_with is <%= @o.inspect %>'))
45 apply_manifest(pp, :catch_failures => true) do |r|
46 expect(r.stdout).to match(/has_interface_with is true/)
51 it 'handles no arguments'
52 it 'handles non strings'