Sha256: 8f2c611d952586b02f4c9ce0d4eb527caf3562b59cbea4a1da7963e6d5e7aed5

Contents?: true

Size: 900 Bytes

Versions: 3

Compression:

Stored size: 900 Bytes

Contents

def init
  super
  @feature = object
    
  sections.push :feature
  
  sections.push :background if object.background
  sections.push :scenarios if object.scenarios
    
end

def background
  @scenario = @feature.background
  @id = "background"
  erb(:scenario)  
end

def scenarios
  scenarios = ""
  
  @feature.scenarios.each_with_index do |scenario,index|
    @scenario = scenario
    @id = "scenario#{index}"
    scenarios += erb(:scenario)
  end
  
  scenarios
end


def highlight_matches(step)
  
  value = h(step.value)
  
  if step.definition
    matches = step.value.match(step.definition.regex)
    
    if matches
      matches[1..-1].reverse.each_with_index do |match,index|
        next if match == nil
        value[matches.begin((matches.size - 1) - index)..(matches.end((matches.size - 1) - index) - 1)] = "<span class='match'>#{match}</span>"
      end
    end
  end
  
  value
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cucumber-in-the-yard-1.7.0 lib/templates/default/feature/setup.rb
cucumber-in-the-yard-1.6.4 lib/templates/default/feature/setup.rb
cucumber-in-the-yard-1.6.3 lib/templates/default/feature/setup.rb