Sha256: 0dcb36257c701f88107d4397a6339df9c4a2911ff7b95540c6d3f5b9e1d0f10e

Contents?: true

Size: 1.18 KB

Versions: 14

Compression:

Stored size: 1.18 KB

Contents


module YARD::CodeObjects::Cucumber

  class ScenarioOutline < NamespaceObject

    attr_accessor :value, :comments, :keyword, :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 examples?
      !@examples[:rows].nil?
    end

    def example_keyword
      @examples[:keyword]
    end
    
    def example_headers
      @examples[:rows].first
    end
    
    def example_data
      return "" unless @examples[:rows]
      @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

14 entries across 14 versions & 2 rubygems

Version Path
yard-cucumber-2.1.3 lib/yard/code_objects/cucumber/scenario_outline.rb
yard-cucumber-2.1.2 lib/yard/code_objects/cucumber/scenario_outline.rb
yard-cucumber-2.1.1 lib/yard/code_objects/cucumber/scenario_outline.rb
yard-cucumber-2.1.0 lib/yard/code_objects/cucumber/scenario_outline.rb
yard-cucumber-2.0.3 lib/yard/code_objects/cucumber/scenario_outline.rb
yard-cucumber-2.0.2 lib/yard/code_objects/cucumber/scenario_outline.rb
yard-cucumber-2.0.1 lib/yard/code_objects/cucumber/scenario_outline.rb
yard-cucumber-2.0.0 lib/yard/code_objects/cucumber/scenario_outline.rb
cucumber-in-the-yard-1.7.8 lib/yard/code_objects/cucumber/scenario_outline.rb
cucumber-in-the-yard-1.7.7 lib/yard/code_objects/cucumber/scenario_outline.rb
cucumber-in-the-yard-1.7.6 lib/yard/code_objects/cucumber/scenario_outline.rb
cucumber-in-the-yard-1.7.5 lib/yard/code_objects/cucumber/scenario_outline.rb
cucumber-in-the-yard-1.7.4 lib/yard/code_objects/cucumber/scenario_outline.rb
cucumber-in-the-yard-1.7.3 lib/yard/code_objects/cucumber/scenario_outline.rb