source: other-projects/hathitrust/vagrant-solr-cluster/trunk/modules/stdlib/spec/acceptance/validate_cmd_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.3 KB
Line 
1#! /usr/bin/env ruby -S rspec
2require 'spec_helper_acceptance'
3
4describe 'validate_cmd function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
5 describe 'success' do
6 it 'validates a true command' do
7 pp = <<-EOS
8 $one = 'foo'
9 if $::osfamily == 'windows' {
10 $two = 'echo' #shell built-in
11 } else {
12 $two = '/bin/echo'
13 }
14 validate_cmd($one,$two)
15 EOS
16
17 apply_manifest(pp, :catch_failures => true)
18 end
19 it 'validates a fail command' do
20 pp = <<-EOS
21 $one = 'foo'
22 if $::osfamily == 'windows' {
23 $two = 'C:/aoeu'
24 } else {
25 $two = '/bin/aoeu'
26 }
27 validate_cmd($one,$two)
28 EOS
29
30 apply_manifest(pp, :expect_failures => true)
31 end
32 it 'validates a fail command with a custom error message' do
33 pp = <<-EOS
34 $one = 'foo'
35 if $::osfamily == 'windows' {
36 $two = 'C:/aoeu'
37 } else {
38 $two = '/bin/aoeu'
39 }
40 validate_cmd($one,$two,"aoeu is dvorak")
41 EOS
42
43 apply_manifest(pp, :expect_failures => true) do |output|
44 expect(output.stderr).to match(/aoeu is dvorak/)
45 end
46 end
47 end
48 describe 'failure' do
49 it 'handles improper number of arguments'
50 it 'handles improper argument types'
51 end
52end
Note: See TracBrowser for help on using the repository browser.