mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-18 16:20:12 +01:00
Removed superfluous 'tracks' directory at the root of the repository.
Testing commits to github.
This commit is contained in:
parent
6a42901514
commit
4cbf5a34d3
2269 changed files with 0 additions and 0 deletions
147
vendor/plugins/selenium-on-rails/test/renderer_test.rb
vendored
Normal file
147
vendor/plugins/selenium-on-rails/test/renderer_test.rb
vendored
Normal file
|
|
@ -0,0 +1,147 @@
|
|||
require File.dirname(__FILE__) + '/test_helper'
|
||||
|
||||
class RendererTest < Test::Unit::TestCase
|
||||
def setup
|
||||
@controller = SeleniumController.new
|
||||
@request = ActionController::TestRequest.new
|
||||
@response = ActionController::TestResponse.new
|
||||
@controller.layout_override =<<END
|
||||
<html><head><title>test layout</title></head><body>
|
||||
@content_for_layout
|
||||
</body></html>
|
||||
END
|
||||
end
|
||||
|
||||
def test_route
|
||||
get :test_file, :testname => 'html.html' #initialize the controller
|
||||
assert_equal 'http://test.host/selenium/tests/suite/test_case.sel',
|
||||
@controller.url_for(:controller => 'selenium', :action => 'test_file', :testname => 'suite/test_case.sel')
|
||||
end
|
||||
|
||||
def test_html
|
||||
get :test_file, :testname => 'html.html'
|
||||
assert_headers
|
||||
expected =<<END
|
||||
<html><head><title>test layout</title></head><body>
|
||||
<p>Testing plain HTML</p>
|
||||
<table>
|
||||
<tr><th colspan="3">Test HTML</th></tr>
|
||||
<tr><td>open</td><td>/selenium/setup</td><td> </td></tr>
|
||||
</table>
|
||||
<p>and it works...</p>
|
||||
</body></html>
|
||||
END
|
||||
assert_text_equal expected, @response.body
|
||||
end
|
||||
|
||||
def test_rhtml
|
||||
get :test_file, :testname => 'rhtml.rhtml'
|
||||
assert_headers
|
||||
expected =<<END
|
||||
<html><head><title>test layout</title></head><body>
|
||||
<table>
|
||||
<tr><th colspan="3">Rhtml</th></tr>
|
||||
<tr><td>open</td><td>/fi</td><td> </td></tr>
|
||||
<tr><td>open</td><td>/fo</td><td> </td></tr>
|
||||
<tr><td>open</td><td>/fum</td><td> </td></tr>
|
||||
<tr><td>assertTitle</td><td>Partial from RHTML</td><td> </td></tr>
|
||||
</table>
|
||||
</body></html>
|
||||
END
|
||||
assert_text_equal expected, @response.body
|
||||
end
|
||||
|
||||
def test_selenese
|
||||
get :test_file, :testname => 'selenese.sel'
|
||||
assert_headers
|
||||
expected =<<END
|
||||
<html><head><title>test layout</title></head><body>
|
||||
<p>Selenese <strong>support</strong></p>
|
||||
<table>
|
||||
<tr><th colspan="3">Selenese</th></tr>
|
||||
<tr><td>open</td><td>/selenium/setup</td><td> </td></tr>
|
||||
<tr><td>goBack</td><td> </td><td> </td></tr>
|
||||
<tr><td>assertTitle</td><td>Partial from Selenese</td><td> </td></tr>
|
||||
</table>
|
||||
<p>works.</p>
|
||||
|
||||
</body></html>
|
||||
END
|
||||
assert_text_equal expected, @response.body
|
||||
end
|
||||
|
||||
def test_rselenese
|
||||
get :test_file, :testname => 'rselenese.rsel'
|
||||
assert_headers
|
||||
expected = <<END
|
||||
<html><head><title>test layout</title></head><body>
|
||||
<table>
|
||||
<tr><th colspan="3">Rselenese</th></tr>
|
||||
<tr><td>open</td><td>/selenium/setup</td><td> </td></tr>
|
||||
<tr><td>open</td><td>/selenium/setup?keep_session=true</td><td> </td></tr>
|
||||
<tr><td>open</td><td>/selenium/setup?fixtures=all</td><td> </td></tr>
|
||||
<tr><td>open</td><td>/selenium/setup?fixtures=foo%2Cbar</td><td> </td></tr>
|
||||
<tr><td>open</td><td>/selenium/setup?fixtures=all&amp;clear_tables=foo%2Cbar</td><td> </td></tr>
|
||||
<tr><td>assertAbsoluteLocation</td><td>exact:http://test.host/selenium/setup</td><td> </td></tr>
|
||||
<tr><td>assertTitle</td><td>selenium</td><td> </td></tr>
|
||||
<tr><td>assertTitle</td><td>Partial from RSelenese</td><td> </td></tr>
|
||||
</table>
|
||||
</body></html>
|
||||
END
|
||||
assert_text_equal expected, @response.body
|
||||
end
|
||||
|
||||
def test_partial_support
|
||||
get :test_file, :testname => 'partials/all_partials.rsel'
|
||||
assert_headers
|
||||
expected = <<END
|
||||
<html><head><title>test layout</title></head><body>
|
||||
<table>
|
||||
<tr><th colspan="3">All partials</th></tr>
|
||||
<tr><td>assertTitle</td><td>Partial from All partials</td><td> </td></tr>
|
||||
<tr><td>type</td><td>partial</td><td>HTML partial</td></tr>
|
||||
<tr><td>type</td><td>world</td><td>RHTML partial</td></tr>
|
||||
<tr><td>type</td><td>partial</td><td>Selenese partial</td></tr>
|
||||
<tr><td>type</td><td>world</td><td>RSelenese partial</td></tr>
|
||||
<tr><td>type</td><td>nesting</td><td>Nesting partial</td></tr>
|
||||
<tr><td>type</td><td>dlrow</td><td>RSelenese partial</td></tr>
|
||||
</table>
|
||||
</body></html>
|
||||
END
|
||||
assert_text_equal expected, @response.body
|
||||
end
|
||||
|
||||
def test_own_layout
|
||||
get :test_file, :testname => 'own_layout.html'
|
||||
assert_headers
|
||||
expected =<<END
|
||||
<html>
|
||||
<head>
|
||||
<title>Test case with own layout</title>
|
||||
<style type="text/css"> body { background-color: #ccc; } </style>
|
||||
</head>
|
||||
<body>
|
||||
<table>
|
||||
<tr><th colspan="3">Test own layout</th></tr>
|
||||
<tr><td>open</td><td>/selenium/setup</td><td> </td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
END
|
||||
assert_text_equal expected, @response.body
|
||||
end
|
||||
|
||||
def test_not_found
|
||||
get :test_file, :testname => 'missing'
|
||||
assert_response 404
|
||||
assert_equal 'Not found', @response.body
|
||||
end
|
||||
|
||||
def assert_headers
|
||||
assert_response :success
|
||||
assert_equal 'no-cache', @response.headers['Cache-control']
|
||||
assert_equal 'no-cache', @response.headers['Pragma']
|
||||
assert_equal '-1', @response.headers['Expires']
|
||||
end
|
||||
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue