spec/lib/elasticity/hive_step_spec.rb in elasticity-5.0.3 vs spec/lib/elasticity/hive_step_spec.rb in elasticity-6.0

- old
+ new

@@ -4,33 +4,37 @@ Elasticity::HiveStep.new('script.hql') end it { should be_a Elasticity::JobFlowStep } - its(:name) { should == 'Elasticity Hive Step (script.hql)' } - its(:script) { should == 'script.hql' } - its(:variables) { should == {} } - its(:action_on_failure) { should == 'TERMINATE_JOB_FLOW' } + describe '.initialize' do + it 'should set the fields appropriately' do + expect(subject.name).to eql('Elasticity Hive Step (script.hql)') + expect(subject.script).to eql('script.hql') + expect(subject.variables).to eql({}) + expect(subject.action_on_failure).to eql('TERMINATE_JOB_FLOW') + end + end describe '#to_aws_step' do it 'should convert to aws step format' do - step = subject.to_aws_step(Elasticity::JobFlow.new('access', 'secret')) + step = subject.to_aws_step(Elasticity::JobFlow.new) step[:name].should == 'Elasticity Hive Step (script.hql)' step[:action_on_failure].should == 'TERMINATE_JOB_FLOW' step[:hadoop_jar_step][:jar].should == 's3://elasticmapreduce/libs/script-runner/script-runner.jar' step[:hadoop_jar_step][:args].should start_with([ - 's3://elasticmapreduce/libs/hive/hive-script', - '--base-path', - 's3://elasticmapreduce/libs/hive/', - '--hive-versions', - 'latest', - '--run-hive-script', - '--args', - '-f', - 'script.hql' - ]) + 's3://elasticmapreduce/libs/hive/hive-script', + '--base-path', + 's3://elasticmapreduce/libs/hive/', + '--hive-versions', + 'latest', + '--run-hive-script', + '--args', + '-f', + 'script.hql' + ]) end context 'when variables are provided' do let(:hs_with_variables) do Elasticity::HiveStep.new('script.pig').tap do |hs| @@ -40,19 +44,19 @@ } end end it 'should convert to aws step format' do - step = hs_with_variables.to_aws_step(Elasticity::JobFlow.new('access', 'secret')) + step = hs_with_variables.to_aws_step(Elasticity::JobFlow.new) step[:hadoop_jar_step][:args][9..13].should == %w(-d VAR1=VALUE1 -d VAR2=VALUE2) end end end describe '.requires_installation?' do it 'should require installation' do - Elasticity::HiveStep.requires_installation?.should be_true + expect(Elasticity::HiveStep.requires_installation?).to be true end end describe '.aws_installation_steps' do \ No newline at end of file