Sha256: c6a1957ace20914a5860ebb24b2d5edede4c5597a5b2346bdc7bafe374b727b3

Contents?: true

Size: 1.38 KB

Versions: 7

Compression:

Stored size: 1.38 KB

Contents

require 'spec_helper'

describe 'misc forklift core' do  
  describe 'steps' do

    before(:each) do 
      ENV['FORKLIFT_RUN_ALL_STEPS'] = 'false'
    end

    after(:each) do
      ENV['FORKLIFT_RUN_ALL_STEPS'] = 'true'
    end

    it "will run all steps with no extra ARGV" do
      plan = SpecPlan.new
      allow(plan).to receive(:argv){ ['/path/to/plan'] }
      steps_run = []
      plan.do! {
        plan.step("a"){ steps_run << 'a' }
        plan.step("b"){ steps_run << 'b' }
        plan.step("c"){ steps_run << 'c' }
      }
      expect(steps_run).to include 'a'
      expect(steps_run).to include 'b'
      expect(steps_run).to include 'c'
    end

    it "will only run steps named within ARGV" do
      plan = SpecPlan.new
      allow(plan).to receive(:argv){ ['/path/to/plan', 'a','c'] }
      steps_run = []
      plan.do! {
        plan.step("a"){ steps_run << 'a' }
        plan.step("b"){ steps_run << 'b' }
        plan.step("c"){ steps_run << 'c' }
      }
      expect(steps_run).to include 'a'
      expect(steps_run).to_not include 'b'
      expect(steps_run).to include 'c'
    end

    it "won't run on a badly defined step" do
      plan = SpecPlan.new
      allow(plan).to receive(:argv){ ['/path/to/plan', 'missing_step'] }
      expect{
        plan.do! {
          plan.step("a"){ raise 'never should get here' }
        }
      }.to raise_error SystemExit
    end
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
forklift_etl-1.1.12 spec/unit/misc/step_spec.rb
forklift_etl-1.1.11 spec/unit/misc/step_spec.rb
forklift_etl-1.1.10 spec/unit/misc/step_spec.rb
forklift_etl-1.1.9 spec/unit/misc/step_spec.rb
forklift_etl-1.1.8 spec/unit/misc/step_spec.rb
forklift_etl-1.1.7 spec/unit/misc/step_spec.rb
forklift_etl-1.1.6 spec/unit/misc/step_spec.rb