Remove the rails selenium test directory and change rake tasks for selenium and rails modes to run the same tests. The end goal should be that the same tests run in both Seleium and Webrat.

This commit is contained in:
Amos King 2009-01-23 15:37:26 -06:00
parent da59584cdf
commit 813adcc238
3 changed files with 5 additions and 82 deletions

View File

@ -16,27 +16,15 @@ namespace :test_unit do
desc "runs the test::unit based tests in webrat mode" desc "runs the test::unit based tests in webrat mode"
task :rails do task :rails do
ENV['WEBRAT_INTEGRATION_MODE'] = 'rails' ENV['WEBRAT_INTEGRATION_MODE'] = 'rails'
Rake::Task['test_unit:rails_test'].execute Rake::Task['test:integration'].execute
end 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" desc "runs the test::unit based tests in selenium mode"
task :selenium do task :selenium do
ENV['WEBRAT_INTEGRATION_MODE'] = 'selenium' ENV['WEBRAT_INTEGRATION_MODE'] = 'selenium'
Rake::Task['test_unit:selenium_test'].execute Rake::Task['test:integration'].execute
end end
Rake::TestTask.new(:selenium_test => "db:test:prepare") do |t| desc "run both selenium and rails mode Test::Unit suites"
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] task :all => [:rails, :selenium]
end end

View File

@ -1,17 +0,0 @@
require 'test_helper'
class WebratTest < ActionController::IntegrationTest
test "should scope within an object" do
visit root_path
within FakeModel.new do
fill_in "Object field", :with => "Test"
assert_raise Webrat::NotFoundError do
check "TOS"
end
end
end
end

View File

@ -1,48 +0,0 @@
require 'test_helper'
class WebratTest < ActionController::IntegrationTest
test "should visit pages" do
visit root_path
assert_contain("Webrat Form")
end
test "should submit forms" do
visit root_path
fill_in "Text field", :with => "Hello"
check "TOS"
select "January"
click_button "Test"
end
test "should follow internal redirects" do
visit internal_redirect_path
assert response_body.include?("OK")
end
test "should not follow external redirects" do
visit external_redirect_path
assert response.redirect?
end
test "should click link by text" do
visit internal_redirect_path
click_link "Test Link Text"
assert_contain("Webrat Form")
end
test "should click link by id" do
visit internal_redirect_path
click_link "link_id"
assert_contain("Webrat Form")
end
test "should be able to assert xpath" do
visit root_path
assert_have_xpath "//h1"
end
test "should be able to assert selector" do
visit root_path
assert_have_selector "h1"
end
end