Sha256: a77bef27ab9427aa8d0c7287a84244fdca056121709f20a88915c774fe32dc58

Contents?: true

Size: 809 Bytes

Versions: 2

Compression:

Stored size: 809 Bytes

Contents

module Turnip
  class ScenarioRunner
    attr_accessor :available_steps
    attr_accessor :context
    attr_accessor :world

    def initialize(world)
      self.world = world
    end

    def load(context)
      self.context = context
      world.extend Turnip::RunnerDSL
      world.turnip_runner = self
      context.modules.each {|mod| world.extend mod }
      self
    end

    def run
      self.available_steps = context.available_background_steps
      context.backgrounds.each do |background|
        run_steps(background.steps)
      end

      self.available_steps = context.available_scenario_steps
      run_steps(context.scenario.steps)
    end

    def run_steps(steps)
      steps.each do |step|
        Turnip::StepDefinition.execute(world, available_steps, step)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
turnip-0.3.1 lib/turnip/scenario_runner.rb
turnip-0.3.0 lib/turnip/scenario_runner.rb