Alias visits as visit, clicks_link as click_link, etc.
This commit is contained in:
parent
13a86880e5
commit
c07c6af339
2
Rakefile
2
Rakefile
@ -56,7 +56,7 @@ end
|
|||||||
|
|
||||||
require 'spec/rake/verify_rcov'
|
require 'spec/rake/verify_rcov'
|
||||||
RCov::VerifyTask.new(:verify_rcov => :rcov) do |t|
|
RCov::VerifyTask.new(:verify_rcov => :rcov) do |t|
|
||||||
t.threshold = 97.1 # Make sure you have rcov 0.7 or higher!
|
t.threshold = 97.2 # Make sure you have rcov 0.7 or higher!
|
||||||
end
|
end
|
||||||
|
|
||||||
remove_task "default"
|
remove_task "default"
|
||||||
|
@ -36,6 +36,8 @@ module Webrat
|
|||||||
field.set(options[:with])
|
field.set(options[:with])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
alias_method :fill_in, :fills_in
|
||||||
|
|
||||||
# Verifies that an input checkbox exists on the current page and marks it
|
# Verifies that an input checkbox exists on the current page and marks it
|
||||||
# as checked, so that the value will be submitted with the form.
|
# as checked, so that the value will be submitted with the form.
|
||||||
#
|
#
|
||||||
@ -46,6 +48,8 @@ module Webrat
|
|||||||
field.check
|
field.check
|
||||||
end
|
end
|
||||||
|
|
||||||
|
alias_method :check, :checks
|
||||||
|
|
||||||
# Verifies that an input checkbox exists on the current page and marks it
|
# Verifies that an input checkbox exists on the current page and marks it
|
||||||
# as unchecked, so that the value will not be submitted with the form.
|
# as unchecked, so that the value will not be submitted with the form.
|
||||||
#
|
#
|
||||||
@ -56,6 +60,8 @@ module Webrat
|
|||||||
field.uncheck
|
field.uncheck
|
||||||
end
|
end
|
||||||
|
|
||||||
|
alias_method :uncheck, :unchecks
|
||||||
|
|
||||||
# Verifies that an input radio button exists on the current page and marks it
|
# Verifies that an input radio button exists on the current page and marks it
|
||||||
# as checked, so that the value will be submitted with the form.
|
# as checked, so that the value will be submitted with the form.
|
||||||
#
|
#
|
||||||
@ -66,6 +72,8 @@ module Webrat
|
|||||||
field.choose
|
field.choose
|
||||||
end
|
end
|
||||||
|
|
||||||
|
alias_method :choose, :chooses
|
||||||
|
|
||||||
# Verifies that a an option element exists on the current page with the specified
|
# Verifies that a an option element exists on the current page with the specified
|
||||||
# text. You can optionally restrict the search to a specific select list by
|
# text. You can optionally restrict the search to a specific select list by
|
||||||
# assigning <tt>options[:from]</tt> the value of the select list's name or
|
# assigning <tt>options[:from]</tt> the value of the select list's name or
|
||||||
@ -89,6 +97,8 @@ module Webrat
|
|||||||
option.choose
|
option.choose
|
||||||
end
|
end
|
||||||
|
|
||||||
|
alias_method :select, :selects
|
||||||
|
|
||||||
# Verifies that an input file field exists on the current page and sets
|
# Verifies that an input file field exists on the current page and sets
|
||||||
# its value to the given +file+, so that the file will be uploaded
|
# its value to the given +file+, so that the file will be uploaded
|
||||||
# along with the form.
|
# along with the form.
|
||||||
@ -100,6 +110,8 @@ module Webrat
|
|||||||
field.set(path)
|
field.set(path)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
alias_method :attach_file, :attaches_file
|
||||||
|
|
||||||
# Saves the page out to RAILS_ROOT/tmp/ and opens it in the default
|
# Saves the page out to RAILS_ROOT/tmp/ and opens it in the default
|
||||||
# web browser if on OS X. Useful for debugging.
|
# web browser if on OS X. Useful for debugging.
|
||||||
#
|
#
|
||||||
@ -139,6 +151,8 @@ module Webrat
|
|||||||
link.click(nil, options)
|
link.click(nil, options)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
alias_method :click_link, :clicks_link
|
||||||
|
|
||||||
# Works like clicks_link, but only looks for the link text within a given selector
|
# Works like clicks_link, but only looks for the link text within a given selector
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
@ -148,6 +162,8 @@ module Webrat
|
|||||||
link.click
|
link.click
|
||||||
end
|
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:
|
||||||
@ -157,6 +173,8 @@ module Webrat
|
|||||||
link.click(:get)
|
link.click(:get)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
alias_method :click_get_link, :clicks_get_link
|
||||||
|
|
||||||
# Works like clicks_link, but issues a DELETE request instead of a GET
|
# Works like clicks_link, but issues a DELETE request instead of a GET
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
@ -166,6 +184,8 @@ module Webrat
|
|||||||
link.click(:delete)
|
link.click(:delete)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
alias_method :click_delete_link, :clicks_delete_link
|
||||||
|
|
||||||
# Works like clicks_link, but issues a POST request instead of a GET
|
# Works like clicks_link, but issues a POST request instead of a GET
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
@ -175,6 +195,8 @@ module Webrat
|
|||||||
link.click(:post)
|
link.click(:post)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
alias_method :click_post_link, :clicks_post_link
|
||||||
|
|
||||||
# Works like clicks_link, but issues a PUT request instead of a GET
|
# Works like clicks_link, but issues a PUT request instead of a GET
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
@ -184,6 +206,8 @@ module Webrat
|
|||||||
link.click(:put)
|
link.click(:put)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
alias_method :click_put_link, :clicks_put_link
|
||||||
|
|
||||||
# Verifies that a submit button exists for the form, then submits the form, follows
|
# Verifies that a submit button exists for the form, then submits the form, follows
|
||||||
# any redirects, and verifies the final page was successful.
|
# any redirects, and verifies the final page was successful.
|
||||||
#
|
#
|
||||||
@ -205,6 +229,8 @@ module Webrat
|
|||||||
button.click
|
button.click
|
||||||
end
|
end
|
||||||
|
|
||||||
|
alias_method :click_button, :clicks_button
|
||||||
|
|
||||||
# Reloads the last page requested. Note that this will resubmit forms
|
# Reloads the last page requested. Note that this will resubmit forms
|
||||||
# and their data.
|
# and their data.
|
||||||
#
|
#
|
||||||
@ -214,9 +240,13 @@ module Webrat
|
|||||||
load_page
|
load_page
|
||||||
end
|
end
|
||||||
|
|
||||||
|
alias_method :reload, :reloads
|
||||||
|
|
||||||
def submits_form(form_id = nil) # :nodoc:
|
def submits_form(form_id = nil) # :nodoc:
|
||||||
end
|
end
|
||||||
|
|
||||||
|
alias_method :submit_form, :submits_form
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def load_page
|
def load_page
|
||||||
|
@ -21,6 +21,8 @@ module Webrat
|
|||||||
Page.new(self, *args)
|
Page.new(self, *args)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
alias_method :visit, :visits
|
||||||
|
|
||||||
def respond_to?(name)
|
def respond_to?(name)
|
||||||
super || current_page.respond_to?(name)
|
super || current_page.respond_to?(name)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user