adding tests for route extentions

Oleg committed May 05, 2011
commit bc410e27f7bdb36a362cbad8d341f42d54a9d552
Showing 2 changed files with 34 additions and 4 deletions
test/integration/render_cms_test.rb +0 -4
@@ @@ -6,7 +6,6 @@ class RenderCmsTest < ActionDispatch::IntegrationTest
Rails.application.routes.draw do
get '/render-implicit' => 'render_test#implicit'
get '/render-explicit' => 'render_test#explicit'
- get '/seed-data-page' => 'render_test#seed_data_page'
get '/render-text' => 'render_test#render_text'
get '/render-update' => 'render_test#render_update'
end
@@ @@ -24,9 +23,6 @@ class RenderCmsTest < ActionDispatch::IntegrationTest
def explicit
render :cms_page => '/render-explicit-page'
end
- def seed_data_page
- render :cms_page => '/'
- end
def render_text
render :text => 'rendered text'
end
test/integration/routing_extensions_test.rb +34 -0
@@ @@ -0,0 +1,34 @@
+ require File.expand_path('../test_helper', File.dirname(__FILE__))
+
+ class RoutingExtensionsTest < ActionDispatch::IntegrationTest
+
+ def teardown
+ reset_config
+ load(File.expand_path('config/routes.rb', Rails.root))
+ end
+
+ def test_get_public_with_content_route_prefix
+ ComfortableMexicanSofa.config.content_route_prefix = 'custom'
+ load(File.expand_path('config/routes.rb', Rails.root))
+
+ get '/custom'
+ assert_response :success
+ assert assigns(:cms_page)
+ assert_equal '/', assigns(:cms_page).full_path
+
+ get '/custom/child-page'
+ assert_response :success
+ assert assigns(:cms_page)
+ assert_equal '/child-page', assigns(:cms_page).full_path
+ end
+
+ def test_get_admin_with_admin_route_prefix
+ ComfortableMexicanSofa.config.admin_route_prefix = 'custom-admin'
+ load(File.expand_path('config/routes.rb', Rails.root))
+
+ assert_equal '/custom-admin/pages', cms_admin_pages_path
+ http_auth :get, cms_admin_pages_path
+ assert_response :success
+ end
+
+ end
\ No newline at end of file