Fix some bugs uncovered when running the weplay scenarios

This commit is contained in:
Bryan Helmkamp 2008-04-07 20:35:06 -04:00
parent d492c4fb90
commit 118cf0340a
4 changed files with 10 additions and 4 deletions

View File

@ -18,6 +18,10 @@ module ActionController
@current_page ||= Webrat::Page.new(self) @current_page ||= Webrat::Page.new(self)
end end
def current_page=(new_page)
@current_page = new_page
end
# Issues a GET request for a page, follows any redirects, and verifies the final page # Issues a GET request for a page, follows any redirects, and verifies the final page
# load was successful. # load was successful.
# #

View File

@ -102,7 +102,7 @@ module Webrat
class ButtonField < Field class ButtonField < Field
def matches_value?(value) def matches_value?(value)
@element["value"] =~ /^\W*#{value}\b/i @element["value"] =~ /^\W*#{Regexp.escape(value.to_s)}\b*/i
end end
def to_param def to_param

View File

@ -16,6 +16,8 @@ module Webrat
reset_dom reset_dom
reloads if @url reloads if @url
session.current_page = self
end end
# Verifies an input field or textarea exists on the current page, and stores a value for # Verifies an input field or textarea exists on the current page, and stores a value for

View File

@ -7,7 +7,7 @@ module Webrat
end end
def matches_text?(text) def matches_text?(text)
@element.innerHTML =~ /^\W*#{Regexp.escape(text.to_s)}\b/i @element.innerHTML == text.to_s
end end
def choose def choose