source: other-projects/hathitrust/vagrant-solr-cluster/trunk/modules/stdlib/spec/acceptance/size_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: 1.4 KB
Line 
1#! /usr/bin/env ruby -S rspec
2require 'spec_helper_acceptance'
3
4describe 'size function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
5 describe 'success' do
6 it 'single string size' do
7 pp = <<-EOS
8 $a = 'discombobulate'
9 $o = size($a)
10 notice(inline_template('size is <%= @o.inspect %>'))
11 EOS
12
13 apply_manifest(pp, :catch_failures => true) do |r|
14 expect(r.stdout).to match(/size is 14/)
15 end
16 end
17 it 'with empty string' do
18 pp = <<-EOS
19 $a = ''
20 $o = size($a)
21 notice(inline_template('size is <%= @o.inspect %>'))
22 EOS
23
24 apply_manifest(pp, :catch_failures => true) do |r|
25 expect(r.stdout).to match(/size is 0/)
26 end
27 end
28 it 'with undef' do
29 pp = <<-EOS
30 $a = undef
31 $o = size($a)
32 notice(inline_template('size is <%= @o.inspect %>'))
33 EOS
34
35 apply_manifest(pp, :catch_failures => true) do |r|
36 expect(r.stdout).to match(/size is 0/)
37 end
38 end
39 it 'strings in array' do
40 pp = <<-EOS
41 $a = ['discombobulate', 'moo']
42 $o = size($a)
43 notice(inline_template('size is <%= @o.inspect %>'))
44 EOS
45
46 apply_manifest(pp, :catch_failures => true) do |r|
47 expect(r.stdout).to match(/size is 2/)
48 end
49 end
50 end
51 describe 'failure' do
52 it 'handles no arguments'
53 it 'handles non strings or arrays'
54 end
55end
Note: See TracBrowser for help on using the repository browser.