Fix some bugs uncovered when running the weplay scenarios
This commit is contained in:
parent
d492c4fb90
commit
118cf0340a
|
@ -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.
|
||||||
#
|
#
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -13,9 +13,11 @@ module Webrat
|
||||||
@url = url
|
@url = url
|
||||||
@method = method
|
@method = method
|
||||||
@data = data
|
@data = data
|
||||||
|
|
||||||
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
|
||||||
|
|
|
@ -6,8 +6,8 @@ module Webrat
|
||||||
@element = element
|
@element = element
|
||||||
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
|
||||||
|
|
Loading…
Reference in New Issue