-#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
describe 'is_mac_address function' do
describe 'success' do
- it 'is_mac_addresss a mac' do
- pp = <<-EOS
+ pp1 = <<-DOC
$a = '00:a0:1f:12:7f:a0'
$b = true
$o = is_mac_address($a)
if $o == $b {
notify { 'output correct': }
}
- EOS
-
- apply_manifest(pp, :catch_failures => true) do |r|
- expect(r.stdout).to match(/Notice: output correct/)
+ DOC
+ it 'is_mac_addresss a mac' do
+ apply_manifest(pp1, :catch_failures => true) do |r|
+ expect(r.stdout).to match(%r{Notice: output correct})
end
end
- it 'is_mac_addresss a mac out of range' do
- pp = <<-EOS
+
+ pp2 = <<-DOC
$a = '00:a0:1f:12:7f:g0'
$b = false
$o = is_mac_address($a)
if $o == $b {
notify { 'output correct': }
}
- EOS
+ DOC
+ it 'is_mac_addresss a mac out of range' do
+ apply_manifest(pp2, :catch_failures => true) do |r|
+ expect(r.stdout).to match(%r{Notice: output correct})
+ end
+ end
- apply_manifest(pp, :catch_failures => true) do |r|
- expect(r.stdout).to match(/Notice: output correct/)
+ pp3 = <<-DOC
+ $a = '80:00:02:09:fe:80:00:00:00:00:00:00:00:24:65:ff:ff:91:a3:12'
+ $b = true
+ $o = is_mac_address($a)
+ if $o == $b {
+ notify { 'output correct': }
+ }
+ DOC
+ it 'is_mac_addresss a 20-octet mac' do
+ apply_manifest(pp3, :catch_failures => true) do |r|
+ expect(r.stdout).to match(%r{Notice: output correct})
end
end
end