Suggest different variables to use if we want to tunnel both v4 and v6
[mirror/dsa-puppet.git] / 3rdparty / modules / stdlib / spec / acceptance / is_domain_name_spec.rb
old mode 100755 (executable)
new mode 100644 (file)
index e0f03fa..b33eb7a
@@ -1,78 +1,76 @@
-#! /usr/bin/env ruby -S rspec
 require 'spec_helper_acceptance'
 
-describe 'is_domain_name function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'is_domain_name function' do
   describe 'success' do
-    it 'is_domain_names arrays' do
-      pp = <<-EOS
+    pp1 = <<-DOC
       $a = ['aaa.com','bbb','ccc']
       $o = is_domain_name($a)
       notice(inline_template('is_domain_name is <%= @o.inspect %>'))
-      EOS
-
-      apply_manifest(pp, :catch_failures => true) do |r|
-        expect(r.stdout).to match(/is_domain_name is false/)
+    DOC
+    it 'is_domain_names arrays' do
+      apply_manifest(pp1, :catch_failures => true) do |r|
+        expect(r.stdout).to match(%r{is_domain_name is false})
       end
     end
-    it 'is_domain_names true' do
-      pp = <<-EOS
+
+    pp2 = <<-DOC
       $a = true
       $o = is_domain_name($a)
       notice(inline_template('is_domain_name is <%= @o.inspect %>'))
-      EOS
-
-      apply_manifest(pp, :catch_failures => true) do |r|
-        expect(r.stdout).to match(/is_domain_name is false/)
+    DOC
+    it 'is_domain_names true' do
+      apply_manifest(pp2, :catch_failures => true) do |r|
+        expect(r.stdout).to match(%r{is_domain_name is false})
       end
     end
-    it 'is_domain_names false' do
-      pp = <<-EOS
+
+    pp3 = <<-DOC
       $a = false
       $o = is_domain_name($a)
       notice(inline_template('is_domain_name is <%= @o.inspect %>'))
-      EOS
-
-      apply_manifest(pp, :catch_failures => true) do |r|
-        expect(r.stdout).to match(/is_domain_name is false/)
+    DOC
+    it 'is_domain_names false' do
+      apply_manifest(pp3, :catch_failures => true) do |r|
+        expect(r.stdout).to match(%r{is_domain_name is false})
       end
     end
-    it 'is_domain_names strings with hyphens' do
-      pp = <<-EOS
+
+    pp4 = <<-DOC
       $a = "3foo-bar.2bar-fuzz.com"
       $b = true
       $o = is_domain_name($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_domain_names strings with hyphens' do
+      apply_manifest(pp4, :catch_failures => true) do |r|
+        expect(r.stdout).to match(%r{Notice: output correct})
       end
     end
-    it 'is_domain_names strings beginning with hyphens' do
-      pp = <<-EOS
+
+    pp5 = <<-DOC
       $a = "-bar.2bar-fuzz.com"
       $b = false
       $o = is_domain_name($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_domain_names strings beginning with hyphens' do
+      apply_manifest(pp5, :catch_failures => true) do |r|
+        expect(r.stdout).to match(%r{Notice: output correct})
       end
     end
-    it 'is_domain_names hashes' do
-      pp = <<-EOS
+
+    pp6 = <<-DOC
       $a = {'aaa'=>'www.com'}
       $o = is_domain_name($a)
       notice(inline_template('is_domain_name is <%= @o.inspect %>'))
-      EOS
-
-      apply_manifest(pp, :catch_failures => true) do |r|
-        expect(r.stdout).to match(/is_domain_name is false/)
+    DOC
+    it 'is_domain_names hashes' do
+      apply_manifest(pp6, :catch_failures => true) do |r|
+        expect(r.stdout).to match(%r{is_domain_name is false})
       end
     end
   end