Permalink
Browse files

Fixing some tests.

  • Loading branch information...
tapajos committed Jul 2, 2008
1 parent 75b79fd commit ec4bff688bb15f6f3ba05da266c99152e8e0b551
Showing with 952 additions and 932 deletions.
  1. +9 −0 log/default.yml
  2. +1 −1 test/renderer_test.rb
  3. +676 −672 test/rselenese_test.rb
  4. +10 −6 test/selenese_test.rb
  5. +48 −48 test/selenium_controller_test.rb
  6. +29 −29 test/setup_test.rb
  7. +173 −173 test/suite_renderer_test.rb
  8. +6 −3 test/test_helper.rb
View
@@ -0,0 +1,9 @@
+---
+result:
+numTestPasses:
+numTestFailures:
+numCommandFailures:
+numCommandPasses:
+numCommandErrors:
+resultDir: ./vendor/plugins/selenium-on-rails/test/../test_result/default
+totalTime:
View
@@ -14,7 +14,7 @@ def setup
def test_route
get :test_file, :testname => 'html.html' #initialize the controller
- assert_equal 'http://test.host/selenium/tests/suite/test_case.sel',
+ assert_equal 'http://test.host/selenium/tests/suite%2Ftest_case.sel',
@controller.url_for(:controller => 'selenium', :action => 'test_file', :testname => 'suite/test_case.sel')
end
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -1,12 +1,16 @@
require File.dirname(__FILE__) + '/test_helper'
class SeleneseTest < Test::Unit::TestCase
-
+
def selenese name, input, partial = nil, type = nil
- view = TestView.new
+ view = TestView.new(File.dirname(__FILE__))
view.override_partial partial, type do
view.assigns['page_title'] = name
- view.render_template 'sel', input
+ path = File.dirname(__FILE__) + "html.sel"
+ File.open(path, 'w+') do |index_file|
+ index_file << input
+ end
+ view.render_template ActionView::Template.new(view, path, false, locals = {})
end
end
@@ -203,13 +207,13 @@ def test_partial_support_with_local_assigns
end
def test_raised_when_more_than_three_columns
- assert_raise RuntimeError, 'There might only be a maximum of three cells!' do
+ assert_raise ActionView::TemplateError, 'There might only be a maximum of three cells!' do
selenese 'name', '|col1|col2|col3|col4|'
end
end
def test_raised_when_more_than_one_set_of_commands
- assert_raise RuntimeError, 'You cannot have comments in the middle of commands!' do
+ assert_raise ActionView::TemplateError, 'You cannot have comments in the middle of commands!' do
input = <<END
comment
|command|
@@ -221,7 +225,7 @@ def test_raised_when_more_than_one_set_of_commands
end
def test_raised_when_incorrect_partial_format
- assert_raise RuntimeError, "Invalid format 'invalid'. Should be '|includePartial|partial|var1=value|var2=value|." do
+ assert_raise ActionView::TemplateError, "Invalid format 'invalid'. Should be '|includePartial|partial|var1=value|var2=value|." do
selenese 'name', '|includePartial|partial|a=valid|invalid|'
end
end
@@ -1,48 +1,48 @@
-require File.dirname(__FILE__) + '/test_helper'
-require "selenium_controller"
-
-class SeleniumControllerTest < Test::Unit::TestCase
-
- def setup
- @controller = SeleniumController.new
- @request = ActionController::TestRequest.new
- @response = ActionController::TestResponse.new
- @result_dir = File.join(File.dirname(__FILE__), "..", "test_result")
- end
-
- def teardown
- FileUtils.rm_rf @result_dir
- end
-
- def test_record_with_result
- SeleniumOnRailsConfig.configs["result_dir"] = @result_dir
- suite = <<EOS
-<script>
-</script>
-<table>
- <tr><td bgcolor="#ccffcc"><a href="/selenium/tests/foo.sel">Foo</a></td></tr>
- <tr><td bgcolor="#ccffcc"><a href="/selenium/tests/bar.sel">Bar</a></td></tr>
-</table>
-EOS
- post :record, :suite => suite,
- "testTable.1" => "<table></table>",
- "testTable.2" => "<table></table>"
- cur_result_dir = File.join(@result_dir, "default")
- assert File.directory?(cur_result_dir)
- assert_equal ["blank.html", "index.html", "suite.html", "test1.html", "test2.html"],
- Dir.glob("#{cur_result_dir}/*.html").map{|path| File.basename(path)}.sort
- expected = <<EOS
-<html>
-<head>
-<link rel="stylesheet" type="text/css" href="selenium-test.css">
-</head>
-<body>
-<table>
- <tr><td bgcolor="#ccffcc"><a href="test1.html" target="testcase">Foo</a></td></tr>
- <tr><td bgcolor="#ccffcc"><a href="test2.html" target="testcase">Bar</a></td></tr>
-</table>
-</body></html>
-EOS
- assert_equal expected, File.read("#{cur_result_dir}/suite.html")
- end
-end
+require File.dirname(__FILE__) + '/test_helper'
+require "selenium_controller"
+
+class SeleniumControllerTest < Test::Unit::TestCase
+
+ def setup
+ @controller = SeleniumController.new
+ @request = ActionController::TestRequest.new
+ @response = ActionController::TestResponse.new
+ @result_dir = File.join(File.dirname(__FILE__), "..", "test_result")
+ end
+
+ def teardown
+ FileUtils.rm_rf @result_dir
+ end
+
+ def test_record_with_result
+ SeleniumOnRailsConfig.configs["result_dir"] = @result_dir
+ suite = <<EOS
+<script>
+</script>
+<table>
+ <tr><td bgcolor="#ccffcc"><a href="/selenium/tests/foo.sel">Foo</a></td></tr>
+ <tr><td bgcolor="#ccffcc"><a href="/selenium/tests/bar.sel">Bar</a></td></tr>
+</table>
+EOS
+ post :record, :suite => suite,
+ "testTable.1" => "<table></table>",
+ "testTable.2" => "<table></table>"
+ cur_result_dir = File.join(@result_dir, "default")
+ assert File.directory?(cur_result_dir)
+ assert_equal ["blank.html", "index.html", "suite.html", "test1.html", "test2.html"],
+ Dir.glob("#{cur_result_dir}/*.html").map{|path| File.basename(path)}.sort
+ expected = <<EOS
+<html>
+<head>
+<link rel="stylesheet" type="text/css" href="selenium-test.css">
+</head>
+<body>
+<table>
+ <tr><td bgcolor="#ccffcc"><a href="test1.html" target="testcase">Foo</a></td></tr>
+ <tr><td bgcolor="#ccffcc"><a href="test2.html" target="testcase">Bar</a></td></tr>
+</table>
+</body></html>
+EOS
+ assert_equal expected, File.read("#{cur_result_dir}/suite.html")
+ end
+end
View
@@ -1,29 +1,29 @@
-require File.dirname(__FILE__) + '/test_helper'
-
-class SetupTest < Test::Unit::TestCase
- def setup
- @controller = SeleniumController.new
- @request = ActionController::TestRequest.new
- @response = ActionController::TestResponse.new
- end
-
- def test_session_reset
- @request.session['key'] = 'value'
- get :setup
- assert_nil session['key']
- assert_response :success
- assert_tag :content => 'The session is wiped clean.'
- end
-
- def test_session_no_reset
- @request.session['key'] = 'value'
- get :setup, :keep_session => true
- assert_equal 'value', session['key']
- assert_response :success
- assert_no_tag :content => 'The session is wiped clean.'
- end
-
- #
- # Don't have the nerve to test fixtures since this is a plugin
- #
-end
+require File.dirname(__FILE__) + '/test_helper'
+
+class SetupTest < Test::Unit::TestCase
+ def setup
+ @controller = SeleniumController.new
+ @request = ActionController::TestRequest.new
+ @response = ActionController::TestResponse.new
+ end
+
+ def test_session_reset
+ @request.session['key'] = 'value'
+ get :setup
+ assert_nil session['key']
+ assert_response :success
+ assert_tag :content => 'The session is wiped clean.'
+ end
+
+ def test_session_no_reset
+ @request.session['key'] = 'value'
+ get :setup, :keep_session => true
+ assert_equal 'value', session['key']
+ assert_response :success
+ assert_no_tag :content => 'The session is wiped clean.'
+ end
+
+ #
+ # Don't have the nerve to test fixtures since this is a plugin
+ #
+end
Oops, something went wrong.

0 comments on commit ec4bff6

Please sign in to comment.