aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/functions/ip_to_erl_format_spec.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/functions/ip_to_erl_format_spec.rb b/spec/functions/ip_to_erl_format_spec.rb
new file mode 100644
index 0000000..b587164
--- /dev/null
+++ b/spec/functions/ip_to_erl_format_spec.rb
@@ -0,0 +1,11 @@
+require 'spec_helper'
+require 'puppet'
+
+describe 'ip_to_erl_format' do
+ it { should run.with_params('192.168.2.1').and_return('{192,168,2,1}') }
+ it { should run.with_params('0.0.0.0').and_return('{0,0,0,0}') }
+ it { should run.with_params('5a40:79cf:8251:5dc5:1624:3c03:3c04:9ba8').and_return('{23104,31183,33361,24005,5668,15363,15364,39848}') }
+ it { should run.with_params('fe80::204:acff:fe17:bf38').and_return('{65152,0,0,0,516,44287,65047,48952}') }
+ it { should run.with_params('::1:2').and_return('{0,0,0,0,0,0,1,2}') }
+ it { should run.with_params('192.256.0.0').and_raise_error(IPAddr::InvalidAddressError) }
+end