Sha256: 302159ef2831860577c9dbf617073dabdaaa8fb4902ba27c20eb0760601ddd20

Contents?: true

Size: 1.07 KB

Versions: 10

Compression:

Stored size: 1.07 KB

Contents


module YARD::CodeObjects::Cucumber

  class ScenarioOutline < NamespaceObject

    attr_accessor :value, :comments, :description, :steps, :tags, :feature
    attr_accessor :scenarios, :examples

    def initialize(namespace,name)
      super(namespace,name.to_s.strip)
      @comments = @description = @value = @feature = nil
      @steps = []
      @tags = []
      @scenarios = []
      @examples = {}
    end

    def background?
      false
    end

    def outline?
      true
    end

    def example_keyword
      @examples[:keyword]
    end
    
    def example_headers
      @examples[:rows].first
    end
    
    def example_data
      @examples[:rows][1..-1]
    end

    def example_values_for_row(row)
      hash = {}

      example_headers.each_with_index do |header,index|
        hash[header] = example_data[row][index]
      end

      hash
    end
    
    def example_hash
      hash = {}
      
      @examples[:rows].each_with_index do |header,index|
        hash[header] = @examples[:rows].collect {|row| row[index] }
      end
      
      hash
    end
    
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
cucumber-in-the-yard-1.7.0 lib/yard/code_objects/cucumber/scenario_outline.rb
cucumber-in-the-yard-1.6.4 lib/yard/code_objects/cucumber/scenario_outline.rb
cucumber-in-the-yard-1.6.3 lib/yard/code_objects/cucumber/scenario_outline.rb
cucumber-in-the-yard-1.6.1 lib/yard/code_objects/cucumber/scenario_outline.rb
cucumber-in-the-yard-1.6.0 lib/yard/code_objects/cucumber/scenario_outline.rb
cucumber-in-the-yard-1.5.4 lib/yard/code_objects/cucumber/scenario_outline.rb
cucumber-in-the-yard-1.5.3 lib/yard/code_objects/cucumber/scenario_outline.rb
cucumber-in-the-yard-1.5.2 lib/yard/code_objects/cucumber/scenario_outline.rb
cucumber-in-the-yard-1.5.1 lib/yard/code_objects/cucumber/scenario_outline.rb
cucumber-in-the-yard-1.5 lib/yard/code_objects/cucumber/scenario_outline.rb