Refactor clicks_link_within to use new within functionality

This commit is contained in:
Bryan Helmkamp 2008-07-26 12:18:51 -04:00
parent e746335d47
commit 592f70950d
2 changed files with 12 additions and 11 deletions

View File

@ -55,6 +55,18 @@ module Webrat
alias_method :reload, :reloads alias_method :reload, :reloads
# Works like clicks_link, but only looks for the link text within a given selector
#
# Example:
# clicks_link_within "#user_12", "Vote"
def clicks_link_within(selector, link_text)
within(selector) do |scope|
scope.clicks_link(link_text)
end
end
alias_method :click_link_within, :clicks_link_within
def_delegators :scope, :fill_in, :fills_in def_delegators :scope, :fill_in, :fills_in
def_delegators :scope, :check, :checks def_delegators :scope, :check, :checks
def_delegators :scope, :uncheck, :unchecks def_delegators :scope, :uncheck, :unchecks
@ -62,7 +74,6 @@ module Webrat
def_delegators :scope, :select, :selects def_delegators :scope, :select, :selects
def_delegators :scope, :attach_file, :attaches_file def_delegators :scope, :attach_file, :attaches_file
def_delegators :scope, :click_link, :clicks_link def_delegators :scope, :click_link, :clicks_link
def_delegators :scope, :click_link_within, :clicks_link_within
def_delegators :scope, :click_get_link, :clicks_get_link def_delegators :scope, :click_get_link, :clicks_get_link
def_delegators :scope, :click_delete_link, :clicks_delete_link def_delegators :scope, :click_delete_link, :clicks_delete_link
def_delegators :scope, :click_post_link, :clicks_post_link def_delegators :scope, :click_post_link, :clicks_post_link

View File

@ -103,16 +103,6 @@ module Webrat
alias_method :click_link, :clicks_link alias_method :click_link, :clicks_link
# Works like clicks_link, but only looks for the link text within a given selector
#
# Example:
# clicks_link_within "#user_12", "Vote"
def clicks_link_within(selector, link_text)
find_link(link_text, selector).click
end
alias_method :click_link_within, :clicks_link_within
# Works like clicks_link, but forces a GET request # Works like clicks_link, but forces a GET request
# #
# Example: # Example: