Created
March 8, 2011 10:26
-
-
Save attilagyorffy/860125 to your computer and use it in GitHub Desktop.
Sections implementation (ala Cucumber) for Steak
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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