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 =<test layout @content_for_layout 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 =<test layout

Testing plain HTML

Test HTML
open/selenium/setup 

and it works...

END assert_text_equal expected, @response.body end def test_rhtml get :test_file, :testname => 'rhtml.rhtml' assert_headers expected =<test layout
Rhtml
open/fi 
open/fo 
open/fum 
assertTitlePartial from RHTML 
END assert_text_equal expected, @response.body end def test_selenese get :test_file, :testname => 'selenese.sel' assert_headers expected =<test layout

Selenese support

Selenese
open/selenium/setup 
goBack  
assertTitlePartial from Selenese 

works.

END assert_text_equal expected, @response.body end def test_rselenese get :test_file, :testname => 'rselenese.rsel' assert_headers expected = <test layout
Rselenese
open/selenium/setup 
open/selenium/setup?keep_session=true 
open/selenium/setup?fixtures=all 
open/selenium/setup?fixtures=foo%2Cbar 
open/selenium/setup?clear_tables=foo%2Cbar&amp;fixtures=all 
assertAbsoluteLocationexact:http://test.host/selenium/setup 
assertTitleselenium 
assertTitlePartial from RSelenese 
END assert_text_equal expected, @response.body end def test_partial_support get :test_file, :testname => 'partials/all_partials.rsel' assert_headers expected = <test layout
All partials
assertTitlePartial from All partials 
typepartialHTML partial
typeworldRHTML partial
typepartialSelenese partial
typeworldRSelenese partial
typenestingNesting partial
typedlrowRSelenese partial
END assert_text_equal expected, @response.body end def test_own_layout get :test_file, :testname => 'own_layout.html' assert_headers expected =< Test case with own layout
Test own layout
open/selenium/setup 
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