Created
March 27, 2012 00:33
-
-
Save cheezy/2211029 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
RSpec::Matchers.define :have_element_named do |expected| | |
match do |page| | |
page.respond_to?("#{expected.to_s}_element") and page.send "#{expected.to_s}?" | |
end | |
failure_message_for_should do |page| | |
"Expected the page to have an element named '#{expected.to_s}'" | |
end | |
failure_message_for_should_not do |page| | |
"Expected the page to not have an element named '#{expected.to_s}'" | |
end | |
end | |
Can be used like this: | |
page.should have_element_named :continue | |
where | |
link(:continue, :id => 'some_id') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment