webrat/Rakefile

165 lines
4.7 KiB
Ruby
Raw Permalink Normal View History

2009-08-10 23:50:42 +00:00
begin
require 'jeweler'
2009-08-10 23:50:42 +00:00
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"
2009-08-10 23:50:42 +00:00
s.rubyforge_project = "webrat"
s.extra_rdoc_files = %w[README.rdoc MIT-LICENSE.txt History.txt]
2009-08-10 23:50:42 +00:00
# Dependencies
s.add_dependency "nokogiri", ">= 1.2.0"
2008-03-02 20:14:52 +00:00
2009-08-10 23:50:42 +00:00
# TODO: Add development dependencies
end
Jeweler::RubyforgeTasks.new
rescue LoadError
puts "Jeweler not available. Install it with: gem install jeweler"
end
2009-08-10 23:50:42 +00:00
# require 'spec'
require 'spec/rake/spectask'
require 'spec/rake/verify_rcov'
2008-10-25 16:42:38 +00:00
desc "Run API and Core specs"
Spec::Rake::SpecTask.new do |t|
t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
t.spec_files = FileList['spec/public/**/*_spec.rb'] + FileList['spec/private/**/*_spec.rb']
end
desc "Run all specs in spec directory with RCov"
Spec::Rake::SpecTask.new(:rcov) do |t|
t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
t.spec_files = FileList['spec/public/**/*_spec.rb'] + FileList['spec/private/**/*_spec.rb']
t.rcov = true
t.rcov_opts = lambda do
IO.readlines(File.dirname(__FILE__) + "/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
end
end
RCov::VerifyTask.new(:verify_rcov => :rcov) do |t|
t.threshold = 96.2 # Make sure you have rcov 0.7 or higher!
end
2009-06-15 04:16:42 +00:00
desc "Run everything against multiruby"
task :multiruby do
result = system "multiruby -S rake spec"
raise "Multiruby tests failed" unless result
2009-06-15 04:46:56 +00:00
result = system "jruby -S rake spec"
raise "JRuby tests failed" unless result
2009-06-15 04:16:42 +00:00
Dir.chdir "spec/integration/rails" do
result = system "multiruby -S rake test_unit:rails"
raise "Rails integration tests failed" unless result
2009-06-15 04:46:56 +00:00
result = system "jruby -S rake test_unit:rails"
raise "Rails integration tests failed" unless result
2009-06-15 04:16:42 +00:00
end
Dir.chdir "spec/integration/merb" do
result = system "multiruby -S rake spec"
raise "Merb integration tests failed" unless result
2009-06-15 04:46:56 +00:00
result = system "jruby -S rake spec"
raise "Rails integration tests failed" unless result
2009-06-15 04:16:42 +00:00
end
Dir.chdir "spec/integration/sinatra" do
result = system "multiruby -S rake test"
raise "Sinatra integration tests failed" unless result
2009-06-15 04:46:56 +00:00
result = system "jruby -S rake test"
raise "Sinatra integration tests failed" unless result
2009-06-15 04:16:42 +00:00
end
Dir.chdir "spec/integration/rack" do
result = system "multiruby -S rake test"
raise "Rack integration tests failed" unless result
2009-06-15 04:46:56 +00:00
result = system "jruby -S rake test"
raise "Rack integration tests failed" unless result
2009-06-15 04:16:42 +00:00
end
2009-06-15 04:46:56 +00:00
puts
puts "Multiruby OK!"
end
desc "Run each spec in isolation to test for dependency issues"
task :spec_deps do
Dir["spec/**/*_spec.rb"].each do |test|
if !system("spec #{test} &> /dev/null")
puts "Dependency Issues: #{test}"
end
end
end
task :prepare do
system "ln -s ../../../../.. ./spec/integration/rails/vendor/plugins/webrat"
end
namespace :spec do
desc "Run the integration specs"
2009-04-15 02:19:57 +00:00
task :integration => ["integration:rails", "integration:merb", "integration:sinatra", "integration:rack"]
namespace :integration do
desc "Run the Rails integration specs"
task :rails => ['rails:webrat'] #,'rails:selenium'] currently not running selenium as it doesn't pass.
namespace :rails do
task :selenium do
Dir.chdir "spec/integration/rails" do
result = system "rake test_unit:selenium"
raise "Rails integration tests failed" unless result
end
end
task :webrat do
Dir.chdir "spec/integration/rails" do
result = system "rake test_unit:rails"
raise "Rails integration tests failed" unless result
end
end
end
desc "Run the Merb integration specs"
task :merb do
Dir.chdir "spec/integration/merb" do
result = system "rake spec"
2009-01-05 02:57:25 +00:00
raise "Merb integration tests failed" unless result
end
2008-12-29 08:41:50 +00:00
end
2009-01-05 02:57:25 +00:00
desc "Run the Sinatra integration specs"
task :sinatra do
Dir.chdir "spec/integration/sinatra" do
result = system "rake test"
2009-04-15 02:19:57 +00:00
raise "Sinatra integration tests failed" unless result
end
end
2009-06-15 04:16:42 +00:00
2009-04-15 02:19:57 +00:00
desc "Run the Sinatra integration specs"
task :rack do
Dir.chdir "spec/integration/rack" do
result = system "rake test"
raise "Rack integration tests failed" unless result
end
end
end
end
2009-04-08 00:29:59 +00:00
desc 'Removes trailing whitespace'
task :whitespace do
sh %{find . -name '*.rb' -exec sed -i '' 's/ *$//g' {} \\;}
2009-08-10 23:50:42 +00:00
end
if defined?(Jeweler)
task :spec => :check_dependencies
end
task :default => :spec