diff --git a/README.txt b/README.txt index 82b186d..9c64fc0 100644 --- a/README.txt +++ b/README.txt @@ -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) diff --git a/Rakefile b/Rakefile index 64b0eb4..d10a280 100644 --- a/Rakefile +++ b/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 diff --git a/lib/webrat/core/field.rb b/lib/webrat/core/field.rb index 2693108..8439f22 100644 --- a/lib/webrat/core/field.rb +++ b/lib/webrat/core/field.rb @@ -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 diff --git a/lib/webrat/core/label.rb b/lib/webrat/core/label.rb index 9bf15b7..87d98cd 100644 --- a/lib/webrat/core/label.rb +++ b/lib/webrat/core/label.rb @@ -11,7 +11,7 @@ module Webrat end def text - @element.innerText + @element.inner_text end end diff --git a/lib/webrat/core/link.rb b/lib/webrat/core/link.rb index 89e532f..ee828a3 100644 --- a/lib/webrat/core/link.rb +++ b/lib/webrat/core/link.rb @@ -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 diff --git a/lib/webrat/core/scope.rb b/lib/webrat/core/scope.rb index 5261473..46c0d44 100644 --- a/lib/webrat/core/scope.rb +++ b/lib/webrat/core/scope.rb @@ -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 diff --git a/lib/webrat/core/select_option.rb b/lib/webrat/core/select_option.rb index c46224f..ffb77cf 100644 --- a/lib/webrat/core/select_option.rb +++ b/lib/webrat/core/select_option.rb @@ -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 diff --git a/spec/webrat/core/field_spec.rb b/spec/webrat/core/field_spec.rb index 87ea0ec..5fb3fea 100644 --- a/spec/webrat/core/field_spec.rb +++ b/spec/webrat/core/field_spec.rb @@ -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').first) + checkbox = CheckboxField.new(nil, (Nokogiri::Hpricot("")/'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').first) + checkbox = CheckboxField.new(nil, (Nokogiri::Hpricot("")/'input').first) checkbox.should_not be_checked end end diff --git a/spec/webrat/core/session_spec.rb b/spec/webrat/core/session_spec.rb index a0790e8..4f0b6bc 100644 --- a/spec/webrat/core/session_spec.rb +++ b/spec/webrat/core/session_spec.rb @@ -14,7 +14,7 @@ describe Webrat::Session do "" 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