Created
November 9, 2010 11:25
-
-
Save wesgibbs/668982 to your computer and use it in GitHub Desktop.
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
# web_custom_steps.rb | |
module ClassMatcher | |
def contains_class(css_class) | |
"contains(concat(' ',normalize-space(@class),' '),' #{css_class} ')" | |
end | |
end | |
World(ClassMatcher) | |
# example step | |
Then /^I should see only one block for ([^\"]*) on ([^\"]*)$/ do |time, day| | |
time = Time.parse(time) | |
page.should have_xpath(%|//div[#{contains_class(day.parameterize)}]/div[#{contains_class(time.to_s(:hmm))}]|, :count => 1) | |
end | |
# credit to http://pivotallabs.com/users/alex/blog/articles/427-xpath-css-class-matching |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment