patching a hole where render options is not a Hash
Oleg
committed Feb 02, 2011
commit 81b467d235a8820b3bb0cdc3266f190469b53a26
Showing 3
changed files with
23 additions
and 3 deletions
comfortable_mexican_sofa/controller_methods.rb b/lib/comfortable_mexican_sofa/controller_methods.rb
+1
-1
| @@ | @@ -21,7 +21,7 @@ module ComfortableMexicanSofa::ControllerMethods |
| # instance variables that can be used in partials (that are included by | |
| # by the cms page and/or layout) | |
| def render_with_cms(options = {}, locals = {}, &block) | |
| - | if path = options.delete(:cms_page) |
| + | if options.is_a?(Hash) && path = options.delete(:cms_page) |
| site = CmsSite.find_by_hostname(request.host.downcase) | |
| page = CmsPage.load_from_file(site, path) if site && ComfortableMexicanSofa.configuration.seed_data_path | |
| page ||= site && site.cms_pages.find_by_full_path(path) | |
test/functional/cms_content_controller_test.rb
+1
-1
| @@ | @@ -22,7 +22,7 @@ class CmsContentControllerTest < ActionController::TestCase |
| cms_layouts(:default).update_attribute(:app_layout, 'cms_admin.html.erb') | |
| get :render_html, :cms_path => '' | |
| assert_response :success | |
| - | assert_select 'body[id=cms_admin]' |
| + | assert_select "body[class='c_cms_content a_render_html']" |
| end | |
| def test_render_page_not_found | |
test/integration/render_cms_test.rb
+21
-1
| @@ | @@ -6,7 +6,9 @@ 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 '/seed-data-page' => 'render_test#seed_data_page' |
| + | get '/render-text' => 'render_test#render_text' |
| + | get '/render-update' => 'render_test#render_update' |
| end | |
| super | |
| end | |
| @@ | @@ -25,6 +27,14 @@ class RenderCmsTest < ActionDispatch::IntegrationTest |
| def seed_data_page | |
| render :cms_page => '/' | |
| end | |
| + | def render_text |
| + | render :text => 'rendered text' |
| + | end |
| + | def render_update |
| + | render :update do |page| |
| + | page.alert('rendered text') |
| + | end |
| + | end |
| end | |
| def test_get_with_no_template | |
| @@ | @@ -58,4 +68,14 @@ class RenderCmsTest < ActionDispatch::IntegrationTest |
| end | |
| end | |
| + | def test_get_render_text |
| + | get '/render-text' |
| + | assert_response :success |
| + | end |
| + | |
| + | def test_get_render_update |
| + | get '/render-update' |
| + | assert_response :success |
| + | end |
| + | |
| end | |
| \ No newline at end of file | |