Sha256: 94de8bd498faf23d45ce387eb6e3732f9ad04888f34ca08a3367836af0798e37

Contents?: true

Size: 1.62 KB

Versions: 7

Compression:

Stored size: 1.62 KB

Contents

describe Elasticity::JobFlowStep do

  class FakeStep
    include Elasticity::JobFlowStep
  end

  subject { FakeStep.new }

  describe '#to_aws_step' do

    it 'should take a job flow as context' do
      subject.should respond_to(:to_aws_step).with(1).argument
    end

    it 'should raise an error by default' do
      expect {
        subject.to_aws_step(nil)
      }.to raise_error(RuntimeError, '#to_aws_step is required to be defined on all job flow steps.')
    end

  end

  describe '#requires_installation?' do
    it 'should delegate to the class method' do
      FakeStep.should_receive(:requires_installation?).and_return(true)
      subject.requires_installation?.should == true
    end
  end

  describe '.requires_installation?' do
    it 'should be false by default' do
      FakeStep.requires_installation?.should be_false
    end
  end

  describe '.aws_installation_step' do
    it 'should raise an error by default' do
      expect {
        FakeStep.aws_installation_step
      }.to raise_error(RuntimeError, '.aws_installation_step is required to be defined when a step requires installation (e.g. Pig, Hive).')
    end
  end

  describe '#aws_installation_step' do
    it 'should delegate to the class method' do
      FakeStep.should_receive(:aws_installation_step).and_return('AWS_INSTALLATION_STEP')
      subject.aws_installation_step.should == 'AWS_INSTALLATION_STEP'
    end
  end

  describe '.steps_requiring_installation' do
    it 'should list all of the steps requiring installation' do
      Elasticity::JobFlowStep.steps_requiring_installation.should =~ [Elasticity::PigStep, Elasticity::HiveStep]
    end
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
elasticity-2.5.1 spec/lib/elasticity/job_flow_step_spec.rb
elasticity-2.5 spec/lib/elasticity/job_flow_step_spec.rb
elasticity-2.4 spec/lib/elasticity/job_flow_step_spec.rb
elasticity-2.3.1 spec/lib/elasticity/job_flow_step_spec.rb
elasticity-2.3 spec/lib/elasticity/job_flow_step_spec.rb
elasticity-2.2 spec/lib/elasticity/job_flow_step_spec.rb
elasticity-2.1.1 spec/lib/elasticity/job_flow_step_spec.rb