summaryrefslogtreecommitdiff
path: root/spec/acceptance/is_ipv4_address_spec.rb
diff options
context:
space:
mode:
authorHunter Haugen <hunter@puppetlabs.com>2016-02-18 10:32:25 -0800
committerHunter Haugen <hunter@puppetlabs.com>2016-02-18 10:32:25 -0800
commit69ca8d09c6124e9b5bd98e62fb201e734ae5bd05 (patch)
tree0193401705d5adee95196efc9830240a596992c4 /spec/acceptance/is_ipv4_address_spec.rb
parent2c3beace2438882fa7dfe89ad5817ea7fe7cba21 (diff)
parentd85aec41a3b57a13f16086cc1ff7ed2fe09602b8 (diff)
Merge pull request #570 from gfidente/master
Add is_ipv4_address and is_ipv6_address functions
Diffstat (limited to 'spec/acceptance/is_ipv4_address_spec.rb')
-rwxr-xr-xspec/acceptance/is_ipv4_address_spec.rb52
1 files changed, 52 insertions, 0 deletions
diff --git a/spec/acceptance/is_ipv4_address_spec.rb b/spec/acceptance/is_ipv4_address_spec.rb
new file mode 100755
index 0000000..5dc6bf5
--- /dev/null
+++ b/spec/acceptance/is_ipv4_address_spec.rb
@@ -0,0 +1,52 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'is_ipv4_address function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+ describe 'success' do
+ it 'is_ipv4_addresss' do
+ pp = <<-EOS
+ $a = '1.2.3.4'
+ $b = true
+ $o = is_ipv4_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/)
+ end
+ end
+ it 'is_ipv4_addresss strings' do
+ pp = <<-EOS
+ $a = "aoeu"
+ $b = false
+ $o = is_ipv4_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/)
+ end
+ end
+ it 'is_ipv4_addresss ipv4 out of range' do
+ pp = <<-EOS
+ $a = '1.2.3.400'
+ $b = false
+ $o = is_ipv4_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/)
+ end
+ end
+ end
+ describe 'failure' do
+ it 'handles improper argument counts'
+ end
+end