From 758e323f89fd122543fcdb7fac9c90061bd0c19b Mon Sep 17 00:00:00 2001 From: Mike Gaffney Date: Tue, 13 Jan 2009 00:26:49 -0600 Subject: [PATCH] breaking up selenium from rails_webrat tests for the moment --- spec/integration/rails/Rakefile | 2 +- .../rails/test/selenium/webrat_test.rb | 26 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 spec/integration/rails/test/selenium/webrat_test.rb diff --git a/spec/integration/rails/Rakefile b/spec/integration/rails/Rakefile index 4149919..3f44dab 100644 --- a/spec/integration/rails/Rakefile +++ b/spec/integration/rails/Rakefile @@ -20,7 +20,7 @@ Rake::Task['test_unit_webrat'].comment = "runs the test::unit based tests in web Rake::TestTask.new(:test_unit_selenium => "db:test:prepare") do |t| ENV['WEBRAT_INTEGRATION_MODE'] = 'selenium' t.libs << "test" - t.pattern = 'test/integration/**/*_test.rb' + t.pattern = 'test/selenium/**/*_test.rb' t.verbose = true end Rake::Task['test_unit_selenium'].comment = "runs the test::unit based tests in selenium mode" \ No newline at end of file diff --git a/spec/integration/rails/test/selenium/webrat_test.rb b/spec/integration/rails/test/selenium/webrat_test.rb new file mode 100644 index 0000000..d6ad832 --- /dev/null +++ b/spec/integration/rails/test/selenium/webrat_test.rb @@ -0,0 +1,26 @@ +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 +end