source: other-projects/hathitrust/vagrant-hadoop-cluster/trunk/modules/stdlib/spec/acceptance/validate_string_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: 1.1 KB
Line 
1#! /usr/bin/env ruby -S rspec
2require 'spec_helper_acceptance'
3
4describe 'validate_string function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
5 describe 'success' do
6 it 'validates a single argument' do
7 pp = <<-EOS
8 $one = 'string'
9 validate_string($one)
10 EOS
11
12 apply_manifest(pp, :catch_failures => true)
13 end
14 it 'validates an multiple arguments' do
15 pp = <<-EOS
16 $one = 'string'
17 $two = 'also string'
18 validate_string($one,$two)
19 EOS
20
21 apply_manifest(pp, :catch_failures => true)
22 end
23 it 'validates undef' do
24 pp = <<-EOS
25 validate_string(undef)
26 EOS
27
28 apply_manifest(pp, :catch_failures => true)
29 end
30 it 'validates a non-string' do
31 {
32 %{validate_string({ 'a' => 'hash' })} => "Hash",
33 %{validate_string(['array'])} => "Array",
34 %{validate_string(false)} => "FalseClass",
35 }.each do |pp,type|
36 expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/a #{type}/)
37 end
38 end
39 end
40 describe 'failure' do
41 it 'handles improper number of arguments'
42 end
43end
Note: See TracBrowser for help on using the repository browser.