Skip to content
Extraits de code Groupes Projets
scope_steps.rb 679 octets
Newer Older
  • Learn to ignore specific revisions
  • module SectionLocator
    
      def within_parent(content, elements = ['*'], &block)
        expr = %(//*[(#{elements.join('|')})/descendant-or-self::*[contains(., "#{content}")]])
        within(expr, &block)
      end
    
    end
    
    World(SectionLocator)
    
    
    Stephen Caudill's avatar
    Stephen Caudill a validé
    sections = %w(h1 h2 h3 h4 h5 h6 legend caption dt strong header)
    
    
    When /^(.*) in the "([^\"]*)" section$/ do |action, title|
      within_parent(title, sections) do
        When action
      end
    end
    
    When /^(.*) in the "([^\"]*)" section:$/ do |action, title, table|
      within_parent(title, sections) do
        When "#{action}:", table
      end
    end
    
    When /^(.*) in the "([^\"]*)" row$/ do |action, title|
      within_parent(title, %w(th td)) do
        When action
      end
    end