source: other-projects/hathitrust/vagrant-hadoop-cluster/trunk/modules/stdlib/spec/functions/shuffle_spec.rb@ 30903

Last change on this file since 30903 was 30903, checked in by davidb, 7 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.7 KB
Line 
1require 'spec_helper'
2
3describe 'shuffle' do
4 it { is_expected.not_to eq(nil) }
5 it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError, /wrong number of arguments/i) }
6 it {
7 pending("Current implementation ignores parameters after the first.")
8 is_expected.to run.with_params([], 'extra').and_raise_error(Puppet::ParseError, /wrong number of arguments/i)
9 }
10 it { is_expected.to run.with_params(1).and_raise_error(Puppet::ParseError, /Requires either array or string to work/) }
11 it { is_expected.to run.with_params({}).and_raise_error(Puppet::ParseError, /Requires either array or string to work/) }
12 it { is_expected.to run.with_params(true).and_raise_error(Puppet::ParseError, /Requires either array or string to work/) }
13
14 context 'when running with a specific seed' do
15 # make tests deterministic
16 before(:each) { srand(2) }
17
18 it { is_expected.to run.with_params([]).and_return([]) }
19 it { is_expected.to run.with_params(['a']).and_return(['a']) }
20 it { is_expected.to run.with_params(['one']).and_return(['one']) }
21 it { is_expected.to run.with_params(['one', 'two', 'three']).and_return(['two', 'one', 'three']) }
22 it { is_expected.to run.with_params(['one', 'two', 'three', 'four']).and_return(['four', 'three', 'two', 'one']) }
23
24 it { is_expected.to run.with_params('').and_return('') }
25 it { is_expected.to run.with_params('a').and_return('a') }
26 it { is_expected.to run.with_params('abc').and_return('bac') }
27 it { is_expected.to run.with_params('abcd').and_return('dcba') }
28
29 context 'when using a class extending String' do
30 it { is_expected.to run.with_params(AlsoString.new('asdfghjkl')).and_return('lkhdsfajg') }
31 end
32 end
33end
Note: See TracBrowser for help on using the repository browser.