Skip to content

Commit

Permalink
Merge branch 'master' into rack
Browse files Browse the repository at this point in the history
  • Loading branch information
brynary committed Aug 11, 2009
2 parents 11996a1 + 987766b commit 19ca271
Show file tree
Hide file tree
Showing 9 changed files with 387 additions and 94 deletions.
10 changes: 9 additions & 1 deletion History.txt
@@ -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

Expand All @@ -9,6 +15,8 @@

* 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)
* 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
Expand Down
95 changes: 30 additions & 65 deletions Rakefile
@@ -1,55 +1,32 @@
# require 'rubygems'
require "rake/gempackagetask"
require 'rake/rdoctask'
require "rake/clean"
gem "rspec", "1.2.6"
require 'spec'
require 'spec/rake/spectask'
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
begin
require 'jeweler'

Rake::GemPackageTask.new(spec) do |package|
package.gem_spec = spec
end
Jeweler::Tasks.new do |s|
s.name = "webrat"
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"

desc 'Show information about the gem.'
task :debug_gem do
puts spec.to_ruby
end
s.rubyforge_project = "webrat"
s.extra_rdoc_files = %w[README.rdoc MIT-LICENSE.txt History.txt]

CLEAN.include ["pkg", "*.gem", "doc", "ri", "coverage"]
# Dependencies
s.add_dependency "nokogiri", ">= 1.2.0"

desc "Upload rdoc to brynary.com"
task :publish_rdoc => :docs do
sh "scp -r doc/ brynary.com:/apps/uploads/webrat"
# 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/verify_rcov'

desc "Run API and Core specs"
Spec::Rake::SpecTask.new do |t|
t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
Expand All @@ -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!
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"
task :multiruby do
result = system "multiruby -S rake spec"
Expand Down Expand Up @@ -192,9 +153,13 @@ namespace :spec do
end
end

task :default => :spec

desc 'Removes trailing whitespace'
task :whitespace do
sh %{find . -name '*.rb' -exec sed -i '' 's/ *$//g' {} \\;}
end
end

if defined?(Jeweler)
task :spec => :check_dependencies
end

task :default => :spec
1 change: 1 addition & 0 deletions VERSION
@@ -0,0 +1 @@
0.4.5
26 changes: 2 additions & 24 deletions lib/webrat.rb
@@ -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
# The common base class for all exceptions raised by Webrat.
class WebratError < StandardError
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

Webrat.require_xml

require "nokogiri"
require "webrat/core/xml/nokogiri"
require "webrat/core"
1 change: 0 additions & 1 deletion lib/webrat/selenium.rb
@@ -1,5 +1,4 @@
require "webrat"
gem "selenium-client", ">=1.2.14"
require "selenium/client"
require "webrat/selenium/silence_stream"
require "webrat/selenium/selenium_session"
Expand Down
6 changes: 4 additions & 2 deletions lib/webrat/selenium/selenium_rc_server.rb
Expand Up @@ -34,7 +34,7 @@ def remote_control

@remote_control = ::Selenium::RemoteControl::RemoteControl.new("0.0.0.0",
Webrat.configuration.selenium_server_port,
Webrat.configuration.selenium_browser_startup_timeout)
:timeout => Webrat.configuration.selenium_browser_startup_timeout)
@remote_control.jar_file = jar_path

return @remote_control
Expand Down Expand Up @@ -74,7 +74,9 @@ def fail

def stop
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

Expand Down
2 changes: 1 addition & 1 deletion spec/private/core/field_spec.rb
Expand Up @@ -2,7 +2,7 @@

module Webrat
describe Field do
unless Webrat.on_java?
unless RUBY_PLATFORM =~ /java/
it "should have nice inspect output" do
html = <<-HTML
<html>
Expand Down
Binary file modified vendor/selenium-server.jar
Binary file not shown.

0 comments on commit 19ca271

Please sign in to comment.