Sha256: da44847212892eb482d625c34347cb95192227c58f0d7bbbb1114e1f34f8243c

Contents?: true

Size: 1.35 KB

Versions: 16

Compression:

Stored size: 1.35 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
      plan.stub(: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
      plan.stub(: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
      plan.stub(: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

16 entries across 16 versions & 1 rubygems

Version Path
forklift_etl-1.1.5 spec/unit/misc/step_spec.rb
forklift_etl-1.1.4 spec/unit/misc/step_spec.rb
forklift_etl-1.1.3 spec/unit/misc/step_spec.rb
forklift_etl-1.1.2 spec/unit/misc/step_spec.rb
forklift_etl-1.1.0 spec/unit/misc/step_spec.rb
forklift_etl-1.0.19 spec/unit/misc/step_spec.rb
forklift_etl-1.0.18 spec/unit/misc/step_spec.rb
forklift_etl-1.0.17 spec/unit/misc/step_spec.rb
forklift_etl-1.0.16 spec/unit/misc/step_spec.rb
forklift_etl-1.0.15 spec/unit/misc/step_spec.rb
forklift_etl-1.0.14 spec/unit/misc/step_spec.rb
forklift_etl-1.0.12 spec/unit/misc/step_spec.rb
forklift_etl-1.0.11 spec/unit/misc/step_spec.rb
forklift_etl-1.0.10 spec/unit/misc/step_spec.rb
forklift_etl-1.0.9 spec/unit/misc/step_spec.rb
forklift_etl-1.0.8 spec/unit/misc/step_spec.rb