source: other-projects/hathitrust/vagrant-solr-cluster/trunk/modules/stdlib/spec/acceptance/is_string_spec.rb@ 30960

Last change on this file since 30960 was 30960, checked in by davidb, 7 years ago

Switch to using Puppet to provision machine. Strongly based on files developed for spark-hdfs cluster

  • Property svn:executable set to *
File size: 2.7 KB
Line 
1#! /usr/bin/env ruby -S rspec
2require 'spec_helper_acceptance'
3
4describe 'is_string function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
5 describe 'success' do
6 it 'is_strings arrays' do
7 pp = <<-EOS
8 $a = ['aaa.com','bbb','ccc']
9 $b = false
10 $o = is_string($a)
11 if $o == $b {
12 notify { 'output correct': }
13 }
14 EOS
15
16 apply_manifest(pp, :catch_failures => true) do |r|
17 expect(r.stdout).to match(/Notice: output correct/)
18 end
19 end
20 it 'is_strings true' do
21 pp = <<-EOS
22 $a = true
23 $b = false
24 $o = is_string($a)
25 if $o == $b {
26 notify { 'output correct': }
27 }
28 EOS
29
30 apply_manifest(pp, :catch_failures => true) do |r|
31 expect(r.stdout).to match(/Notice: output correct/)
32 end
33 end
34 it 'is_strings strings' do
35 pp = <<-EOS
36 $a = "aoeu"
37 $o = is_string($a)
38 notice(inline_template('is_string is <%= @o.inspect %>'))
39 EOS
40
41 apply_manifest(pp, :catch_failures => true) do |r|
42 expect(r.stdout).to match(/is_string is true/)
43 end
44 end
45 it 'is_strings number strings' do
46 pp = <<-EOS
47 $a = "3"
48 $o = is_string($a)
49 notice(inline_template('is_string is <%= @o.inspect %>'))
50 EOS
51
52 apply_manifest(pp, :catch_failures => true) do |r|
53 expect(r.stdout).to match(/is_string is false/)
54 end
55 end
56 it 'is_strings floats' do
57 pp = <<-EOS
58 $a = 3.5
59 $b = false
60 $o = is_string($a)
61 if $o == $b {
62 notify { 'output correct': }
63 }
64 EOS
65
66 apply_manifest(pp, :catch_failures => true) do |r|
67 expect(r.stdout).to match(/Notice: output correct/)
68 end
69 end
70 it 'is_strings integers' do
71 pp = <<-EOS
72 $a = 3
73 $b = false
74 $o = is_string($a)
75 if $o == $b {
76 notify { 'output correct': }
77 }
78 EOS
79
80 apply_manifest(pp, :catch_failures => true) do |r|
81 expect(r.stdout).to match(/Notice: output correct/)
82 end
83 end
84 it 'is_strings hashes' do
85 pp = <<-EOS
86 $a = {'aaa'=>'www.com'}
87 $b = false
88 $o = is_string($a)
89 if $o == $b {
90 notify { 'output correct': }
91 }
92 EOS
93
94 apply_manifest(pp, :catch_failures => true) do |r|
95 expect(r.stdout).to match(/Notice: output correct/)
96 end
97 end
98 it 'is_strings undef' do
99 pp = <<-EOS
100 $a = undef
101 $o = is_string($a)
102 notice(inline_template('is_string is <%= @o.inspect %>'))
103 EOS
104
105 apply_manifest(pp, :catch_failures => true) do |r|
106 expect(r.stdout).to match(/is_string is true/)
107 end
108 end
109 end
110 describe 'failure' do
111 it 'handles improper argument counts'
112 end
113end
Note: See TracBrowser for help on using the repository browser.