Switching from Hpricot to Nokogiri
This commit is contained in:
parent
006a70c0c5
commit
5510a6a61d
@ -78,13 +78,6 @@ In your stories/helper.rb:
|
||||
|
||||
You could also unpack the gem into vendor/plugins.
|
||||
|
||||
=== Requirements
|
||||
|
||||
- Rails >= 1.2.6
|
||||
- Hpricot >= 0.6
|
||||
- Rails integration tests in Test::Unit _or_
|
||||
- Cucumber
|
||||
|
||||
=== Authors
|
||||
|
||||
- Maintained by [Bryan Helmkamp](mailto:bryan@brynary.com)
|
||||
|
1
Rakefile
1
Rakefile
@ -27,7 +27,6 @@ spec = Gem::Specification.new do |s|
|
||||
s.extra_rdoc_files = %w(README.txt MIT-LICENSE.txt)
|
||||
|
||||
# Dependencies
|
||||
s.add_dependency "hpricot", ">= 0.6"
|
||||
s.add_dependency "nokogiri", ">= 1.0.3"
|
||||
end
|
||||
|
||||
|
@ -67,7 +67,7 @@ module Webrat
|
||||
elsif defined?(ActionController::AbstractRequest)
|
||||
ActionController::AbstractRequest.parse_query_parameters(key_and_value)
|
||||
else
|
||||
Merb::Parse.query(key_and_value)
|
||||
::Merb::Parse.query(key_and_value)
|
||||
end
|
||||
end
|
||||
|
||||
@ -141,7 +141,7 @@ module Webrat
|
||||
class ButtonField < Field
|
||||
|
||||
def matches_text?(text)
|
||||
@element.innerHTML =~ /#{Regexp.escape(text.to_s)}/i
|
||||
@element.inner_html =~ /#{Regexp.escape(text.to_s)}/i
|
||||
end
|
||||
|
||||
def matches_value?(value)
|
||||
@ -315,7 +315,7 @@ module Webrat
|
||||
selected_options = @element / "option:first" if selected_options.empty?
|
||||
selected_options.map do |option|
|
||||
return "" if option.nil?
|
||||
option["value"] || option.innerHTML
|
||||
option["value"] || option.inner_html
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -11,7 +11,7 @@ module Webrat
|
||||
end
|
||||
|
||||
def text
|
||||
@element.innerText
|
||||
@element.inner_text
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -22,7 +22,7 @@ module Webrat
|
||||
end
|
||||
|
||||
def matches_text?(link_text)
|
||||
html = text.gsub(' ',' ')
|
||||
html = text.gsub(' ',' ')
|
||||
|
||||
if link_text.is_a?(Regexp)
|
||||
matcher = link_text
|
||||
@ -34,7 +34,7 @@ module Webrat
|
||||
end
|
||||
|
||||
def text
|
||||
@element.innerHTML
|
||||
@element.inner_html
|
||||
end
|
||||
|
||||
protected
|
||||
|
@ -1,4 +1,4 @@
|
||||
require "hpricot"
|
||||
require "nokogiri"
|
||||
require "webrat/core/form"
|
||||
require "webrat/core/locators"
|
||||
|
||||
@ -139,7 +139,7 @@ module Webrat
|
||||
alias_method :clicks_button, :click_button
|
||||
|
||||
def dom # :nodoc:
|
||||
@dom ||= Hpricot(scoped_html)
|
||||
@dom ||= Nokogiri::Hpricot(scoped_html)
|
||||
end
|
||||
|
||||
protected
|
||||
@ -155,7 +155,7 @@ module Webrat
|
||||
def scoped_html
|
||||
@scoped_html ||= begin
|
||||
if @selector
|
||||
(Hpricot(@html) / @selector).first.to_html
|
||||
(Nokogiri::Hpricot(@html) / @selector).first.to_html
|
||||
else
|
||||
@html
|
||||
end
|
||||
|
@ -8,9 +8,9 @@ module Webrat
|
||||
|
||||
def matches_text?(text)
|
||||
if text.is_a?(Regexp)
|
||||
@element.innerHTML =~ text
|
||||
@element.inner_html =~ text
|
||||
else
|
||||
@element.innerHTML == text.to_s
|
||||
@element.inner_html == text.to_s
|
||||
end
|
||||
end
|
||||
|
||||
@ -22,7 +22,7 @@ module Webrat
|
||||
protected
|
||||
|
||||
def value
|
||||
@element["value"] || @element.innerHTML
|
||||
@element["value"] || @element.inner_html
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -3,12 +3,12 @@ require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
|
||||
module Webrat
|
||||
describe CheckboxField do
|
||||
it "should say it is checked if it is" do
|
||||
checkbox = CheckboxField.new(nil, (Hpricot("<input type='checkbox' checked='checked'>")/'input').first)
|
||||
checkbox = CheckboxField.new(nil, (Nokogiri::Hpricot("<input type='checkbox' checked='checked'>")/'input').first)
|
||||
checkbox.should be_checked
|
||||
end
|
||||
|
||||
it "should say it is not checked if it is not" do
|
||||
checkbox = CheckboxField.new(nil, (Hpricot("<input type='checkbox'>")/'input').first)
|
||||
checkbox = CheckboxField.new(nil, (Nokogiri::Hpricot("<input type='checkbox'>")/'input').first)
|
||||
checkbox.should_not be_checked
|
||||
end
|
||||
end
|
||||
|
@ -14,7 +14,7 @@ describe Webrat::Session do
|
||||
"<html></html>"
|
||||
end
|
||||
|
||||
session.current_dom.should be_an_instance_of(Hpricot::Doc)
|
||||
session.current_dom.should be_an_instance_of(Nokogiri::HTML::Document)
|
||||
end
|
||||
|
||||
it "should open the page in the browser" do
|
||||
|
Loading…
Reference in New Issue
Block a user