source: other-projects/hathitrust/vagrant-solr-cluster/trunk/modules/stdlib/spec/acceptance/pick_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.2 KB
Line 
1#! /usr/bin/env ruby -S rspec
2require 'spec_helper_acceptance'
3
4describe 'pick function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
5 describe 'success' do
6 it 'picks a default value' do
7 pp = <<-EOS
8 $a = undef
9 $o = pick($a, 'default')
10 notice(inline_template('picked is <%= @o.inspect %>'))
11 EOS
12
13 apply_manifest(pp, :catch_failures => true) do |r|
14 expect(r.stdout).to match(/picked is "default"/)
15 end
16 end
17 it 'picks the first set value' do
18 pp = <<-EOS
19 $a = "something"
20 $b = "long"
21 $o = pick($a, $b, 'default')
22 notice(inline_template('picked is <%= @o.inspect %>'))
23 EOS
24
25 apply_manifest(pp, :catch_failures => true) do |r|
26 expect(r.stdout).to match(/picked is "something"/)
27 end
28 end
29 end
30 describe 'failure' do
31 it 'raises error with all undef values' do
32 pp = <<-EOS
33 $a = undef
34 $b = undef
35 $o = pick($a, $b)
36 notice(inline_template('picked is <%= @o.inspect %>'))
37 EOS
38
39 apply_manifest(pp, :expect_failures => true) do |r|
40 expect(r.stderr).to match(/must receive at least one non empty value/)
41 end
42 end
43 end
44end
Note: See TracBrowser for help on using the repository browser.