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:
parent
da59584cdf
commit
813adcc238
@ -16,25 +16,13 @@ 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
|
||||
Rake::Task['test:integration'].execute
|
||||
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
|
||||
Rake::Task['test:integration'].execute
|
||||
end
|
||||
|
||||
desc "run both selenium and rails mode Test::Unit suites"
|
||||
|
@ -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
|
@ -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
|
Loading…
Reference in New Issue
Block a user