fixed rakefile so the tasks will run the correct mode, and so there is a task to run both modes.

This commit is contained in:
Amos King 2009-01-13 07:57:20 -06:00
parent 758e323f89
commit a396758da4
2 changed files with 30 additions and 19 deletions

View File

@ -9,18 +9,34 @@ require 'rake/rdoctask'
require 'tasks/rails'
Rake::TestTask.new(:test_unit_webrat => "db:test:prepare") do |t|
ENV['WEBRAT_INTEGRATION_MODE'] = 'webrat'
t.libs << "test"
t.pattern = 'test/integration/**/*_test.rb'
t.verbose = true
end
Rake::Task['test_unit_webrat'].comment = "runs the test::unit based tests in webrat mode"
Rake::TestTask.new(:test_unit_selenium => "db:test:prepare") do |t|
ENV['WEBRAT_INTEGRATION_MODE'] = 'selenium'
t.libs << "test"
t.pattern = 'test/selenium/**/*_test.rb'
t.verbose = true
namespace :test_unit do
desc "runs the test::unit based tests in webrat mode"
task :rails do
ENV['WEBRAT_INTEGRATION_MODE'] = 'rails'
Rake::Task['test_unit:rails_test'].execute
end
Rake::TestTask.new(:rails_test => "db:test:prepare") do |t|
t.libs << "test"
t.pattern = 'test/integration/**/*_test.rb'
t.verbose = true
end
desc "runs the test::unit based tests in selenium mode"
task :selenium do
ENV['WEBRAT_INTEGRATION_MODE'] = 'selenium'
Rake::Task['test_unit:selenium_test'].execute
end
Rake::TestTask.new(:selenium_test => "db:test:prepare") do |t|
t.libs << "test"
t.pattern = 'test/selenium/**/*_test.rb'
t.verbose = true
end
desc "run both selenium and rails mode Test::Unit suites"
task :all => [:rails, :selenium]
end
Rake::Task['test_unit_selenium'].comment = "runs the test::unit based tests in selenium mode"

View File

@ -6,12 +6,7 @@ require "redgreen"
require File.dirname(__FILE__) + "/../../../../lib/webrat"
Webrat.configure do |config|
mode = case ENV['WEBRAT_INTEGRATION_MODE']
when 'webrat': :rails
when 'selenium': :selenium
else :rails
end
config.mode = mode
config.mode = ENV['WEBRAT_INTEGRATION_MODE'].to_sym
end
ActionController::Base.class_eval do