Merge branch 'master' into rack

This commit is contained in:
Bryan Helmkamp 2009-08-10 20:18:24 -04:00
commit 19ca271bbd
9 changed files with 390 additions and 97 deletions

View File

@ -1,4 +1,10 @@
== 0.4.5 / ? == Git
* Minor enhancements
* Don't require rubygems at runtime (Simon Rozet)
== 0.4.5 / 2009-08-10
* Major enhancements * Major enhancements
@ -9,6 +15,8 @@
* Minor enhancements * Minor enhancements
* Upgrade to selenium-client to 1.2.16 (Brian Landau)
* Upgrade selenium-server.jar to 1.0.1 (Brian Landau)
* Make redirect detection work in the face of rational maths (like when ruby-units is active) (Piers Cawley) * Make redirect detection work in the face of rational maths (like when ruby-units is active) (Piers Cawley)
* Use Launchy to handle opening pages in the browser with cross-platform compatibility (Bryan Helmkamp) * Use Launchy to handle opening pages in the browser with cross-platform compatibility (Bryan Helmkamp)
* Added support for field_labeled_locators ending in non word characters * Added support for field_labeled_locators ending in non word characters

101
Rakefile
View File

@ -1,54 +1,31 @@
# require 'rubygems' begin
require "rake/gempackagetask" require 'jeweler'
require 'rake/rdoctask'
require "rake/clean" Jeweler::Tasks.new do |s|
gem "rspec", "1.2.6" s.name = "webrat"
require 'spec' s.author = "Bryan Helmkamp"
s.email = "bryan" + "@" + "brynary.com"
s.homepage = "http://github.com/brynary/webrat"
s.summary = "Ruby Acceptance Testing for Web applications"
# s.description = "TODO"
s.rubyforge_project = "webrat"
s.extra_rdoc_files = %w[README.rdoc MIT-LICENSE.txt History.txt]
# Dependencies
s.add_dependency "nokogiri", ">= 1.2.0"
# TODO: Add development dependencies
end
Jeweler::RubyforgeTasks.new
rescue LoadError
puts "Jeweler not available. Install it with: gem install jeweler"
end
# require 'spec'
require 'spec/rake/spectask' require 'spec/rake/spectask'
require 'spec/rake/verify_rcov' require 'spec/rake/verify_rcov'
require File.expand_path('./lib/webrat.rb')
##############################################################################
# Package && release
##############################################################################
spec = Gem::Specification.new do |s|
s.name = "webrat"
s.version = Webrat::VERSION
s.platform = Gem::Platform::RUBY
s.author = "Bryan Helmkamp"
s.email = "bryan" + "@" + "brynary.com"
s.homepage = "http://github.com/brynary/webrat"
s.summary = "Webrat. Ruby Acceptance Testing for Web applications"
s.bindir = "bin"
s.description = s.summary
s.require_path = "lib"
s.files = %w(History.txt install.rb MIT-LICENSE.txt README.rdoc Rakefile) + Dir["lib/**/*"] + Dir["vendor/**/*"]
# rdoc
s.has_rdoc = true
s.extra_rdoc_files = %w(README.rdoc MIT-LICENSE.txt)
# Dependencies
s.add_dependency "nokogiri", ">= 1.2.0"
s.rubyforge_project = "webrat"
end
Rake::GemPackageTask.new(spec) do |package|
package.gem_spec = spec
end
desc 'Show information about the gem.'
task :debug_gem do
puts spec.to_ruby
end
CLEAN.include ["pkg", "*.gem", "doc", "ri", "coverage"]
desc "Upload rdoc to brynary.com"
task :publish_rdoc => :docs do
sh "scp -r doc/ brynary.com:/apps/uploads/webrat"
end
desc "Run API and Core specs" desc "Run API and Core specs"
Spec::Rake::SpecTask.new do |t| Spec::Rake::SpecTask.new do |t|
@ -70,22 +47,6 @@ RCov::VerifyTask.new(:verify_rcov => :rcov) do |t|
t.threshold = 96.2 # Make sure you have rcov 0.7 or higher! t.threshold = 96.2 # Make sure you have rcov 0.7 or higher!
end end
desc 'Install the package as a gem.'
task :install_gem => [:clean, :package] do
gem_filename = Dir['pkg/*.gem'].first
sh "sudo gem install --no-rdoc --no-ri --local #{gem_filename}"
end
desc "Delete generated RDoc"
task :clobber_docs do
FileUtils.rm_rf("doc")
end
desc "Generate RDoc"
task :docs => :clobber_docs do
system "hanna --title 'Webrat #{Webrat::VERSION} API Documentation'"
end
desc "Run everything against multiruby" desc "Run everything against multiruby"
task :multiruby do task :multiruby do
result = system "multiruby -S rake spec" result = system "multiruby -S rake spec"
@ -192,9 +153,13 @@ namespace :spec do
end end
end end
task :default => :spec
desc 'Removes trailing whitespace' desc 'Removes trailing whitespace'
task :whitespace do task :whitespace do
sh %{find . -name '*.rb' -exec sed -i '' 's/ *$//g' {} \\;} sh %{find . -name '*.rb' -exec sed -i '' 's/ *$//g' {} \\;}
end end
if defined?(Jeweler)
task :spec => :check_dependencies
end
task :default => :spec

1
VERSION Normal file
View File

@ -0,0 +1 @@
0.4.5

View File

@ -1,31 +1,9 @@
require "rubygems"
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__))) unless $LOAD_PATH.include?(File.expand_path(File.dirname(__FILE__)))
module Webrat module Webrat
# The common base class for all exceptions raised by Webrat. # The common base class for all exceptions raised by Webrat.
class WebratError < StandardError class WebratError < StandardError
end end
VERSION = '0.4.4'
def self.require_xml
if on_java?
gem "nokogiri", ">= 1.2.4"
else
gem "nokogiri", ">= 1.0.6"
end
require "nokogiri"
require "webrat/core/xml/nokogiri"
end
def self.on_java?
RUBY_PLATFORM =~ /java/
end
end end
Webrat.require_xml require "nokogiri"
require "webrat/core/xml/nokogiri"
require "webrat/core" require "webrat/core"

View File

@ -1,5 +1,4 @@
require "webrat" require "webrat"
gem "selenium-client", ">=1.2.14"
require "selenium/client" require "selenium/client"
require "webrat/selenium/silence_stream" require "webrat/selenium/silence_stream"
require "webrat/selenium/selenium_session" require "webrat/selenium/selenium_session"

View File

@ -34,7 +34,7 @@ module Webrat
@remote_control = ::Selenium::RemoteControl::RemoteControl.new("0.0.0.0", @remote_control = ::Selenium::RemoteControl::RemoteControl.new("0.0.0.0",
Webrat.configuration.selenium_server_port, Webrat.configuration.selenium_server_port,
Webrat.configuration.selenium_browser_startup_timeout) :timeout => Webrat.configuration.selenium_browser_startup_timeout)
@remote_control.jar_file = jar_path @remote_control.jar_file = jar_path
return @remote_control return @remote_control
@ -74,7 +74,9 @@ module Webrat
def stop def stop
silence_stream(STDOUT) do silence_stream(STDOUT) do
::Selenium::RemoteControl::RemoteControl.new("0.0.0.0", Webrat.configuration.selenium_server_port, 5).stop ::Selenium::RemoteControl::RemoteControl.new("0.0.0.0",
Webrat.configuration.selenium_server_port,
:timeout => 5).stop
end end
end end

View File

@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
module Webrat module Webrat
describe Field do describe Field do
unless Webrat.on_java? unless RUBY_PLATFORM =~ /java/
it "should have nice inspect output" do it "should have nice inspect output" do
html = <<-HTML html = <<-HTML
<html> <html>

Binary file not shown.

340
webrat.gemspec Normal file
View File

@ -0,0 +1,340 @@
# Generated by jeweler
# DO NOT EDIT THIS FILE
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{webrat}
s.version = "0.4.5"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Bryan Helmkamp"]
s.date = %q{2009-08-10}
s.email = %q{bryan@brynary.com}
s.extra_rdoc_files = [
"History.txt",
"MIT-LICENSE.txt",
"README.rdoc"
]
s.files = [
".document",
".gitignore",
"History.txt",
"MIT-LICENSE.txt",
"README.rdoc",
"Rakefile",
"VERSION",
"install.rb",
"lib/webrat.rb",
"lib/webrat/core.rb",
"lib/webrat/core/configuration.rb",
"lib/webrat/core/elements/area.rb",
"lib/webrat/core/elements/element.rb",
"lib/webrat/core/elements/field.rb",
"lib/webrat/core/elements/form.rb",
"lib/webrat/core/elements/label.rb",
"lib/webrat/core/elements/link.rb",
"lib/webrat/core/elements/select_option.rb",
"lib/webrat/core/locators.rb",
"lib/webrat/core/locators/area_locator.rb",
"lib/webrat/core/locators/button_locator.rb",
"lib/webrat/core/locators/field_by_id_locator.rb",
"lib/webrat/core/locators/field_labeled_locator.rb",
"lib/webrat/core/locators/field_locator.rb",
"lib/webrat/core/locators/field_named_locator.rb",
"lib/webrat/core/locators/form_locator.rb",
"lib/webrat/core/locators/label_locator.rb",
"lib/webrat/core/locators/link_locator.rb",
"lib/webrat/core/locators/locator.rb",
"lib/webrat/core/locators/select_option_locator.rb",
"lib/webrat/core/logging.rb",
"lib/webrat/core/matchers.rb",
"lib/webrat/core/matchers/have_content.rb",
"lib/webrat/core/matchers/have_selector.rb",
"lib/webrat/core/matchers/have_tag.rb",
"lib/webrat/core/matchers/have_xpath.rb",
"lib/webrat/core/methods.rb",
"lib/webrat/core/mime.rb",
"lib/webrat/core/save_and_open_page.rb",
"lib/webrat/core/scope.rb",
"lib/webrat/core/session.rb",
"lib/webrat/core/xml.rb",
"lib/webrat/core/xml/hpricot.rb",
"lib/webrat/core/xml/nokogiri.rb",
"lib/webrat/core/xml/rexml.rb",
"lib/webrat/core_extensions/blank.rb",
"lib/webrat/core_extensions/deprecate.rb",
"lib/webrat/core_extensions/detect_mapped.rb",
"lib/webrat/core_extensions/meta_class.rb",
"lib/webrat/core_extensions/nil_to_param.rb",
"lib/webrat/core_extensions/tcp_socket.rb",
"lib/webrat/mechanize.rb",
"lib/webrat/merb.rb",
"lib/webrat/merb_multipart_support.rb",
"lib/webrat/merb_session.rb",
"lib/webrat/rack.rb",
"lib/webrat/rack_test.rb",
"lib/webrat/rails.rb",
"lib/webrat/rspec-rails.rb",
"lib/webrat/selenium.rb",
"lib/webrat/selenium/application_server_factory.rb",
"lib/webrat/selenium/application_servers.rb",
"lib/webrat/selenium/application_servers/base.rb",
"lib/webrat/selenium/application_servers/external.rb",
"lib/webrat/selenium/application_servers/merb.rb",
"lib/webrat/selenium/application_servers/rails.rb",
"lib/webrat/selenium/application_servers/sinatra.rb",
"lib/webrat/selenium/location_strategy_javascript/button.js",
"lib/webrat/selenium/location_strategy_javascript/label.js",
"lib/webrat/selenium/location_strategy_javascript/webrat.js",
"lib/webrat/selenium/location_strategy_javascript/webratlink.js",
"lib/webrat/selenium/location_strategy_javascript/webratlinkwithin.js",
"lib/webrat/selenium/location_strategy_javascript/webratselectwithoption.js",
"lib/webrat/selenium/matchers.rb",
"lib/webrat/selenium/matchers/have_content.rb",
"lib/webrat/selenium/matchers/have_selector.rb",
"lib/webrat/selenium/matchers/have_tag.rb",
"lib/webrat/selenium/matchers/have_xpath.rb",
"lib/webrat/selenium/selenium_extensions.js",
"lib/webrat/selenium/selenium_rc_server.rb",
"lib/webrat/selenium/selenium_session.rb",
"lib/webrat/selenium/silence_stream.rb",
"lib/webrat/sinatra.rb",
"spec/fakes/test_session.rb",
"spec/integration/merb/.gitignore",
"spec/integration/merb/Rakefile",
"spec/integration/merb/app/controllers/application.rb",
"spec/integration/merb/app/controllers/exceptions.rb",
"spec/integration/merb/app/controllers/testing.rb",
"spec/integration/merb/app/views/exceptions/not_acceptable.html.erb",
"spec/integration/merb/app/views/exceptions/not_found.html.erb",
"spec/integration/merb/app/views/layout/application.html.erb",
"spec/integration/merb/app/views/testing/show_form.html.erb",
"spec/integration/merb/app/views/testing/upload.html.erb",
"spec/integration/merb/config/environments/development.rb",
"spec/integration/merb/config/environments/rake.rb",
"spec/integration/merb/config/environments/test.rb",
"spec/integration/merb/config/init.rb",
"spec/integration/merb/config/rack.rb",
"spec/integration/merb/config/router.rb",
"spec/integration/merb/spec/spec.opts",
"spec/integration/merb/spec/spec_helper.rb",
"spec/integration/merb/spec/webrat_spec.rb",
"spec/integration/merb/tasks/merb.thor/app_script.rb",
"spec/integration/merb/tasks/merb.thor/common.rb",
"spec/integration/merb/tasks/merb.thor/gem_ext.rb",
"spec/integration/merb/tasks/merb.thor/main.thor",
"spec/integration/merb/tasks/merb.thor/ops.rb",
"spec/integration/merb/tasks/merb.thor/utils.rb",
"spec/integration/rack/Rakefile",
"spec/integration/rack/rack_app.rb",
"spec/integration/rack/test/test_helper.rb",
"spec/integration/rack/test/webrat_rack_test.rb",
"spec/integration/rails/.gitignore",
"spec/integration/rails/Rakefile",
"spec/integration/rails/app/controllers/application.rb",
"spec/integration/rails/app/controllers/buttons_controller.rb",
"spec/integration/rails/app/controllers/fields_controller.rb",
"spec/integration/rails/app/controllers/links_controller.rb",
"spec/integration/rails/app/controllers/webrat_controller.rb",
"spec/integration/rails/app/helpers/buttons_helper.rb",
"spec/integration/rails/app/helpers/fields_helper.rb",
"spec/integration/rails/app/helpers/links_helper.rb",
"spec/integration/rails/app/views/buttons/show.html.erb",
"spec/integration/rails/app/views/fields/show.html.erb",
"spec/integration/rails/app/views/links/show.html.erb",
"spec/integration/rails/app/views/webrat/before_redirect_form.html.erb",
"spec/integration/rails/app/views/webrat/buttons.html.erb",
"spec/integration/rails/app/views/webrat/form.html.erb",
"spec/integration/rails/config/boot.rb",
"spec/integration/rails/config/environment.rb",
"spec/integration/rails/config/environments/development.rb",
"spec/integration/rails/config/environments/selenium.rb",
"spec/integration/rails/config/environments/test.rb",
"spec/integration/rails/config/initializers/inflections.rb",
"spec/integration/rails/config/initializers/mime_types.rb",
"spec/integration/rails/config/initializers/new_rails_defaults.rb",
"spec/integration/rails/config/locales/en.yml",
"spec/integration/rails/config/routes.rb",
"spec/integration/rails/public/404.html",
"spec/integration/rails/public/422.html",
"spec/integration/rails/public/500.html",
"spec/integration/rails/script/about",
"spec/integration/rails/script/console",
"spec/integration/rails/script/dbconsole",
"spec/integration/rails/script/destroy",
"spec/integration/rails/script/generate",
"spec/integration/rails/script/performance/benchmarker",
"spec/integration/rails/script/performance/profiler",
"spec/integration/rails/script/performance/request",
"spec/integration/rails/script/plugin",
"spec/integration/rails/script/process/inspector",
"spec/integration/rails/script/process/reaper",
"spec/integration/rails/script/process/spawner",
"spec/integration/rails/script/runner",
"spec/integration/rails/script/server",
"spec/integration/rails/test/integration/button_click_test.rb",
"spec/integration/rails/test/integration/fill_in_test.rb",
"spec/integration/rails/test/integration/link_click_test.rb",
"spec/integration/rails/test/integration/webrat_test.rb",
"spec/integration/rails/test/test_helper.rb",
"spec/integration/sinatra/Rakefile",
"spec/integration/sinatra/classic_app.rb",
"spec/integration/sinatra/modular_app.rb",
"spec/integration/sinatra/test/classic_app_test.rb",
"spec/integration/sinatra/test/modular_app_test.rb",
"spec/integration/sinatra/test/test_helper.rb",
"spec/private/core/configuration_spec.rb",
"spec/private/core/field_spec.rb",
"spec/private/core/link_spec.rb",
"spec/private/core/logging_spec.rb",
"spec/private/core/session_spec.rb",
"spec/private/mechanize/mechanize_session_spec.rb",
"spec/private/merb/attaches_file_spec.rb",
"spec/private/merb/merb_session_spec.rb",
"spec/private/nokogiri_spec.rb",
"spec/private/rails/attaches_file_spec.rb",
"spec/private/rails/rails_session_spec.rb",
"spec/private/selenium/application_servers/rails_spec.rb",
"spec/public/basic_auth_spec.rb",
"spec/public/check_spec.rb",
"spec/public/choose_spec.rb",
"spec/public/click_area_spec.rb",
"spec/public/click_button_spec.rb",
"spec/public/click_link_spec.rb",
"spec/public/fill_in_spec.rb",
"spec/public/locators/field_by_xpath_spec.rb",
"spec/public/locators/field_labeled_spec.rb",
"spec/public/locators/field_with_id_spec.rb",
"spec/public/matchers/contain_spec.rb",
"spec/public/matchers/have_selector_spec.rb",
"spec/public/matchers/have_tag_spec.rb",
"spec/public/matchers/have_xpath_spec.rb",
"spec/public/reload_spec.rb",
"spec/public/save_and_open_spec.rb",
"spec/public/select_date_spec.rb",
"spec/public/select_datetime_spec.rb",
"spec/public/select_spec.rb",
"spec/public/select_time_spec.rb",
"spec/public/selenium/application_server_factory_spec.rb",
"spec/public/selenium/application_servers/external_spec.rb",
"spec/public/selenium/selenium_session_spec.rb",
"spec/public/set_hidden_field_spec.rb",
"spec/public/submit_form_spec.rb",
"spec/public/visit_spec.rb",
"spec/public/within_spec.rb",
"spec/rcov.opts",
"spec/spec.opts",
"spec/spec_helper.rb",
"vendor/selenium-server.jar",
"webrat.gemspec"
]
s.homepage = %q{http://github.com/brynary/webrat}
s.rdoc_options = ["--charset=UTF-8"]
s.require_paths = ["lib"]
s.rubyforge_project = %q{webrat}
s.rubygems_version = %q{1.3.4}
s.summary = %q{Ruby Acceptance Testing for Web applications}
s.test_files = [
"spec/fakes/test_session.rb",
"spec/integration/merb/app/controllers/application.rb",
"spec/integration/merb/app/controllers/exceptions.rb",
"spec/integration/merb/app/controllers/testing.rb",
"spec/integration/merb/config/environments/development.rb",
"spec/integration/merb/config/environments/rake.rb",
"spec/integration/merb/config/environments/test.rb",
"spec/integration/merb/config/init.rb",
"spec/integration/merb/config/rack.rb",
"spec/integration/merb/config/router.rb",
"spec/integration/merb/spec/spec_helper.rb",
"spec/integration/merb/spec/webrat_spec.rb",
"spec/integration/merb/tasks/merb.thor/app_script.rb",
"spec/integration/merb/tasks/merb.thor/common.rb",
"spec/integration/merb/tasks/merb.thor/gem_ext.rb",
"spec/integration/merb/tasks/merb.thor/ops.rb",
"spec/integration/merb/tasks/merb.thor/utils.rb",
"spec/integration/rack/rack_app.rb",
"spec/integration/rack/test/test_helper.rb",
"spec/integration/rack/test/webrat_rack_test.rb",
"spec/integration/rails/app/controllers/application.rb",
"spec/integration/rails/app/controllers/buttons_controller.rb",
"spec/integration/rails/app/controllers/fields_controller.rb",
"spec/integration/rails/app/controllers/links_controller.rb",
"spec/integration/rails/app/controllers/webrat_controller.rb",
"spec/integration/rails/app/helpers/buttons_helper.rb",
"spec/integration/rails/app/helpers/fields_helper.rb",
"spec/integration/rails/app/helpers/links_helper.rb",
"spec/integration/rails/config/boot.rb",
"spec/integration/rails/config/environment.rb",
"spec/integration/rails/config/environments/development.rb",
"spec/integration/rails/config/environments/selenium.rb",
"spec/integration/rails/config/environments/test.rb",
"spec/integration/rails/config/initializers/inflections.rb",
"spec/integration/rails/config/initializers/mime_types.rb",
"spec/integration/rails/config/initializers/new_rails_defaults.rb",
"spec/integration/rails/config/routes.rb",
"spec/integration/rails/test/integration/button_click_test.rb",
"spec/integration/rails/test/integration/fill_in_test.rb",
"spec/integration/rails/test/integration/link_click_test.rb",
"spec/integration/rails/test/integration/webrat_test.rb",
"spec/integration/rails/test/test_helper.rb",
"spec/integration/sinatra/classic_app.rb",
"spec/integration/sinatra/modular_app.rb",
"spec/integration/sinatra/test/classic_app_test.rb",
"spec/integration/sinatra/test/modular_app_test.rb",
"spec/integration/sinatra/test/test_helper.rb",
"spec/private/core/configuration_spec.rb",
"spec/private/core/field_spec.rb",
"spec/private/core/link_spec.rb",
"spec/private/core/logging_spec.rb",
"spec/private/core/session_spec.rb",
"spec/private/mechanize/mechanize_session_spec.rb",
"spec/private/merb/attaches_file_spec.rb",
"spec/private/merb/merb_session_spec.rb",
"spec/private/nokogiri_spec.rb",
"spec/private/rails/attaches_file_spec.rb",
"spec/private/rails/rails_session_spec.rb",
"spec/private/selenium/application_servers/rails_spec.rb",
"spec/public/basic_auth_spec.rb",
"spec/public/check_spec.rb",
"spec/public/choose_spec.rb",
"spec/public/click_area_spec.rb",
"spec/public/click_button_spec.rb",
"spec/public/click_link_spec.rb",
"spec/public/fill_in_spec.rb",
"spec/public/locators/field_by_xpath_spec.rb",
"spec/public/locators/field_labeled_spec.rb",
"spec/public/locators/field_with_id_spec.rb",
"spec/public/matchers/contain_spec.rb",
"spec/public/matchers/have_selector_spec.rb",
"spec/public/matchers/have_tag_spec.rb",
"spec/public/matchers/have_xpath_spec.rb",
"spec/public/reload_spec.rb",
"spec/public/save_and_open_spec.rb",
"spec/public/select_date_spec.rb",
"spec/public/select_datetime_spec.rb",
"spec/public/select_spec.rb",
"spec/public/select_time_spec.rb",
"spec/public/selenium/application_server_factory_spec.rb",
"spec/public/selenium/application_servers/external_spec.rb",
"spec/public/selenium/selenium_session_spec.rb",
"spec/public/set_hidden_field_spec.rb",
"spec/public/submit_form_spec.rb",
"spec/public/visit_spec.rb",
"spec/public/within_spec.rb",
"spec/spec_helper.rb"
]
if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 3
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<nokogiri>, [">= 1.2.0"])
else
s.add_dependency(%q<nokogiri>, [">= 1.2.0"])
end
else
s.add_dependency(%q<nokogiri>, [">= 1.2.0"])
end
end