Skip to content

Instantly share code, notes, and snippets.

@attilagyorffy
Created March 8, 2011 10:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save attilagyorffy/860125 to your computer and use it in GitHub Desktop.
Save attilagyorffy/860125 to your computer and use it in GitHub Desktop.
Sections implementation (ala Cucumber) for Steak
module SectionHelpers
def selector_of_section(section_name)
case section_name
when 'recent podcasts'
[:css, 'ul.podcasts']
when /^the row containing "[\"+]"$/
[:xpath, "//*[.='#{$1}']/ancestor::tr"]
else
raise "Can't find mapping from \"#{section_name}\" to a section."
end
end
def within_section(section_name)
within *selector_of_section(section_name) do
yield
end
end
end
RSpec.configuration.include SectionHelpers, :type => :acceptance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment