Skip to content

Instantly share code, notes, and snippets.

@Peeja
Created October 20, 2008 23:28
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 Peeja/18211 to your computer and use it in GitHub Desktop.
Save Peeja/18211 to your computer and use it in GitHub Desktop.
# config.include(HaveTagExtensions) to do things like:
#
# response.should have_tag("form input#email") do
# with_value("dewey@duckberg.gov")
# end
#
# response.should have_tag("strong") do
# with_text("Important!")
# end
module HaveTagExtensions
def with_text(text)
with_tag("*", text)
end
def method_missing(id, *args)
if id.to_s =~ /^with_([a-z]+)$/
with_tag("[#{$1}=?]", *args)
else
super
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment