diff --git a/Rakefile b/Rakefile index 601fac31..9bd083a9 100644 --- a/Rakefile +++ b/Rakefile @@ -56,7 +56,7 @@ end require 'spec/rake/verify_rcov' 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 remove_task "default" diff --git a/lib/webrat/core/page.rb b/lib/webrat/core/page.rb index 61fb1900..f9f88bf5 100644 --- a/lib/webrat/core/page.rb +++ b/lib/webrat/core/page.rb @@ -36,6 +36,8 @@ def fills_in(id_or_name_or_label, options = {}) field.set(options[:with]) end + alias_method :fill_in, :fills_in + # 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. # @@ -46,6 +48,8 @@ def checks(id_or_name_or_label) field.check end + alias_method :check, :checks + # 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. # @@ -56,6 +60,8 @@ def unchecks(id_or_name_or_label) field.uncheck end + alias_method :uncheck, :unchecks + # 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. # @@ -66,6 +72,8 @@ def chooses(label) field.choose end + alias_method :choose, :chooses + # 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 # assigning options[:from] the value of the select list's name or @@ -89,6 +97,8 @@ def selects(option_text, options = {}) option.choose end + alias_method :select, :selects + # 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 # along with the form. @@ -100,6 +110,8 @@ def attaches_file(id_or_name_or_label, path) field.set(path) end + alias_method :attach_file, :attaches_file + # Saves the page out to RAILS_ROOT/tmp/ and opens it in the default # web browser if on OS X. Useful for debugging. # @@ -139,6 +151,8 @@ def clicks_link(link_text, options = {}) link.click(nil, options) end + alias_method :click_link, :clicks_link + # Works like clicks_link, but only looks for the link text within a given selector # # Example: @@ -148,6 +162,8 @@ def clicks_link_within(selector, link_text) link.click end + alias_method :click_link_within, :clicks_link_within + # Works like clicks_link, but forces a GET request # # Example: @@ -157,6 +173,8 @@ def clicks_get_link(link_text) link.click(:get) end + alias_method :click_get_link, :clicks_get_link + # Works like clicks_link, but issues a DELETE request instead of a GET # # Example: @@ -166,6 +184,8 @@ def clicks_delete_link(link_text) link.click(:delete) end + alias_method :click_delete_link, :clicks_delete_link + # Works like clicks_link, but issues a POST request instead of a GET # # Example: @@ -175,6 +195,8 @@ def clicks_post_link(link_text) link.click(:post) end + alias_method :click_post_link, :clicks_post_link + # Works like clicks_link, but issues a PUT request instead of a GET # # Example: @@ -184,6 +206,8 @@ def clicks_put_link(link_text) link.click(:put) end + alias_method :click_put_link, :clicks_put_link + # Verifies that a submit button exists for the form, then submits the form, follows # any redirects, and verifies the final page was successful. # @@ -205,6 +229,8 @@ def clicks_button(value = nil) button.click end + alias_method :click_button, :clicks_button + # Reloads the last page requested. Note that this will resubmit forms # and their data. # @@ -214,9 +240,13 @@ def reloads load_page end + alias_method :reload, :reloads + def submits_form(form_id = nil) # :nodoc: end + alias_method :submit_form, :submits_form + protected def load_page diff --git a/lib/webrat/core/session.rb b/lib/webrat/core/session.rb index 6bcf3ee3..987a46ae 100644 --- a/lib/webrat/core/session.rb +++ b/lib/webrat/core/session.rb @@ -21,6 +21,8 @@ def visits(*args) Page.new(self, *args) end + alias_method :visit, :visits + def respond_to?(name) super || current_page.respond_to?(name) end