source: other-projects/hathitrust/vagrant-hadoop-cluster/trunk/modules/stdlib/spec/acceptance/is_domain_name_spec.rb@ 30903

Last change on this file since 30903 was 30903, checked in by davidb, 8 years ago

Vagrant provisioning files for a 4-node Hadoop cluster. See README.txt for more details

  • Property svn:executable set to *
File size: 2.3 KB
Line 
1#! /usr/bin/env ruby -S rspec
2require 'spec_helper_acceptance'
3
4describe 'is_domain_name function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
5 describe 'success' do
6 it 'is_domain_names arrays' do
7 pp = <<-EOS
8 $a = ['aaa.com','bbb','ccc']
9 $o = is_domain_name($a)
10 notice(inline_template('is_domain_name is <%= @o.inspect %>'))
11 EOS
12
13 apply_manifest(pp, :catch_failures => true) do |r|
14 expect(r.stdout).to match(/is_domain_name is false/)
15 end
16 end
17 it 'is_domain_names true' do
18 pp = <<-EOS
19 $a = true
20 $o = is_domain_name($a)
21 notice(inline_template('is_domain_name is <%= @o.inspect %>'))
22 EOS
23
24 apply_manifest(pp, :catch_failures => true) do |r|
25 expect(r.stdout).to match(/is_domain_name is false/)
26 end
27 end
28 it 'is_domain_names false' do
29 pp = <<-EOS
30 $a = false
31 $o = is_domain_name($a)
32 notice(inline_template('is_domain_name is <%= @o.inspect %>'))
33 EOS
34
35 apply_manifest(pp, :catch_failures => true) do |r|
36 expect(r.stdout).to match(/is_domain_name is false/)
37 end
38 end
39 it 'is_domain_names strings with hyphens' do
40 pp = <<-EOS
41 $a = "3foo-bar.2bar-fuzz.com"
42 $b = true
43 $o = is_domain_name($a)
44 if $o == $b {
45 notify { 'output correct': }
46 }
47 EOS
48
49 apply_manifest(pp, :catch_failures => true) do |r|
50 expect(r.stdout).to match(/Notice: output correct/)
51 end
52 end
53 it 'is_domain_names strings beginning with hyphens' do
54 pp = <<-EOS
55 $a = "-bar.2bar-fuzz.com"
56 $b = false
57 $o = is_domain_name($a)
58 if $o == $b {
59 notify { 'output correct': }
60 }
61 EOS
62
63 apply_manifest(pp, :catch_failures => true) do |r|
64 expect(r.stdout).to match(/Notice: output correct/)
65 end
66 end
67 it 'is_domain_names hashes' do
68 pp = <<-EOS
69 $a = {'aaa'=>'www.com'}
70 $o = is_domain_name($a)
71 notice(inline_template('is_domain_name is <%= @o.inspect %>'))
72 EOS
73
74 apply_manifest(pp, :catch_failures => true) do |r|
75 expect(r.stdout).to match(/is_domain_name is false/)
76 end
77 end
78 end
79 describe 'failure' do
80 it 'handles improper argument counts'
81 it 'handles non-arrays'
82 end
83end
Note: See TracBrowser for help on using the repository browser.