Skip to content

Instantly share code, notes, and snippets.

@martinhawkins
Created December 14, 2010 11:19
Show Gist options
  • Save martinhawkins/740282 to your computer and use it in GitHub Desktop.
Save martinhawkins/740282 to your computer and use it in GitHub Desktop.
Cucumber step definition to detect whether a disabled select option exists
Then /^"([^"]*)" from "([^"]*)" within "([^"]*)" should be disabled$/ do |option_name, type_label, selector|
with_scope(selector) do
x=page.find(:xpath, '//body').all(:xpath, XPath.generate { |x| x.descendant(:select).descendant(:option)[x.attr(:disabled) == 'disabled'] })
x.collect(&:text).should include(option_text)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment