Sha256: f4d04f67072d9a0a9d2a6a224419ad8f5bab068f2f063e9acac3ed947582f944

Contents?: true

Size: 793 Bytes

Versions: 2

Compression:

Stored size: 793 Bytes

Contents

module Turnip
  class ScenarioContext
    attr_accessor :feature
    attr_accessor :scenario

    def initialize(feature, scenario)
      self.feature = feature
      self.scenario = scenario
    end

    def available_background_steps
      available_steps_for(*feature_tags)
    end

    def available_scenario_steps
      available_steps_for(*scenario_tags)
    end

    def backgrounds
      feature.backgrounds
    end

    def modules
      Turnip::StepModule.modules_for(*scenario_tags)
    end

    private

    def available_steps_for(*tags)
      Turnip::StepModule.all_steps_for(*tags)
    end

    def feature_tags
      @feature_tags ||= feature.active_tags.uniq
    end

    def scenario_tags
      @scenario_tags ||= (feature_tags + scenario.active_tags).uniq
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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