From 399b493cb454e6f6dd1a310ba31adaa8e6550830 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Sun, 6 Jun 2010 02:20:45 -0300 Subject: content_tag_string shouldn't escape_html if escape param is false --- actionpack/test/template/tag_helper_test.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'actionpack/test') diff --git a/actionpack/test/template/tag_helper_test.rb b/actionpack/test/template/tag_helper_test.rb index 256d9bdcde..ec5fe3d1d7 100644 --- a/actionpack/test/template/tag_helper_test.rb +++ b/actionpack/test/template/tag_helper_test.rb @@ -39,6 +39,8 @@ class TagHelperTest < ActionView::TestCase content_tag("a", "Create", :href => "create") assert_equal "

<script>evil_js</script>

", content_tag(:p, '') + assert_equal "

", + content_tag(:p, '', nil, false) end def test_content_tag_with_block_in_erb -- cgit v1.2.3 From ab764ecbfea31a3b14323283287e2fc80955ace6 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Sun, 6 Jun 2010 02:16:26 -0300 Subject: Makes text_helper methods sanitize the input if the input is not safe or :safe => true option is not provided --- actionpack/test/template/text_helper_test.rb | 102 +++++++++++++++++++++++++-- 1 file changed, 96 insertions(+), 6 deletions(-) (limited to 'actionpack/test') diff --git a/actionpack/test/template/text_helper_test.rb b/actionpack/test/template/text_helper_test.rb index bb808b77a5..9d7106b2e5 100644 --- a/actionpack/test/template/text_helper_test.rb +++ b/actionpack/test/template/text_helper_test.rb @@ -45,19 +45,42 @@ class TextHelperTest < ActionView::TestCase assert simple_format(" test with html tags ").html_safe? end - def test_simple_format_should_escape_unsafe_input - assert_equal "

<b> test with unsafe string </b>

", simple_format(" test with unsafe string ") + def test_simple_format_should_sanitize_unsafe_input + assert_equal "

test with unsafe string

", simple_format(" test with unsafe string ") end - def test_simple_format_should_not_escape_safe_input + def test_simple_format_should_not_sanitize_input_if_safe_option + assert_equal "

test with unsafe string

", simple_format(" test with unsafe string ", {}, :safe => true) + end + + def test_simple_format_should_not_sanitize_safe_input assert_equal "

test with safe string

", simple_format(" test with safe string ".html_safe) end + def test_truncate_should_be_html_safe + assert truncate("Hello World!", :length => 12).html_safe? + end + def test_truncate assert_equal "Hello World!", truncate("Hello World!", :length => 12) assert_equal "Hello Wor...", truncate("Hello World!!", :length => 12) end + def test_truncate_should_sanitize_unsafe_input + assert_equal "Hello World!", truncate("Hello World!", :length => 12) + assert_equal "Hello Wor...", truncate("Hello World!!", :length => 12) + end + + def test_truncate_should_not_sanitize_input_if_safe_option + assert_equal "Hello code!World!", :length => 12, :safe => true) + assert_equal "Hello code!World!!", :length => 12, :safe => true) + end + + def test_truncate_should_not_sanitize_safe_input + assert_equal "Hello code!World!".html_safe, :length => 12) + assert_equal "Hello code!World!!".html_safe, :length => 12) + end + def test_truncate_should_use_default_length_of_30 str = "This is a string that will go longer then the default truncate length of 30" assert_equal str[0...27] + "...", truncate(str) @@ -93,7 +116,11 @@ class TextHelperTest < ActionView::TestCase end end - def test_highlighter + def test_highlight_should_be_html_safe + assert highlight("This is a beautiful morning", "beautiful").html_safe? + end + + def test_highlight assert_equal( "This is a beautiful morning", highlight("This is a beautiful morning", "beautiful") @@ -117,6 +144,27 @@ class TextHelperTest < ActionView::TestCase assert_equal ' ', highlight(' ', 'blank text is returned verbatim') end + def test_highlight_should_sanitize_unsafe_input + assert_equal( + "This is a beautiful morning", + highlight("This is a beautiful morning", "beautiful") + ) + end + + def test_highlight_should_not_sanitize_input_if_safe_option + assert_equal( + "This is a beautiful morning", + highlight("This is a beautiful morning", "beautiful", :safe => true) + ) + end + + def test_highlight_should_not_sanitize_safe_input + assert_equal( + "This is a beautiful morning", + highlight("This is a beautiful morning".html_safe, "beautiful") + ) + end + def test_highlight_with_regexp assert_equal( "This is a beautiful! morning", @@ -163,7 +211,7 @@ class TextHelperTest < ActionView::TestCase highlight("

This is a beautiful morning, but also a beautiful day

", "beautiful") ) assert_equal( - "

This is a beautiful morning, but also a beautiful day

", + "

This is a beautiful morning, but also a beautiful day

", highlight("

This is a beautiful morning, but also a beautiful day

", "beautiful") ) end @@ -286,7 +334,17 @@ class TextHelperTest < ActionView::TestCase %{#{CGI::escapeHTML link_text}} end - def test_auto_linking + def test_auto_link_should_be_html_safe + email_raw = 'santiago@wyeworks.com' + link_raw = 'http://www.rubyonrails.org' + + assert auto_link(nil).html_safe? + assert auto_link('').html_safe? + assert auto_link("#{link_raw} #{link_raw} #{link_raw}").html_safe? + assert auto_link("hello #{email_raw}").html_safe? + end + + def test_auto_link email_raw = 'david@loudthinking.com' email_result = %{#{email_raw}} link_raw = 'http://www.rubyonrails.com' @@ -378,6 +436,21 @@ class TextHelperTest < ActionView::TestCase assert_equal %(

#{link10_result} Link

), auto_link("

#{link10_raw} Link

") end + def test_auto_link_should_sanitize_unsafe_input + link_raw = %{http://www.rubyonrails.com?id=1&num=2} + assert_equal %{http://www.rubyonrails.com?id=1&num=2}, auto_link(link_raw) + end + + def test_auto_link_should_sanitize_unsafe_input + link_raw = %{http://www.rubyonrails.com?id=1&num=2} + assert_equal %{http://www.rubyonrails.com?id=1&num=2}, auto_link(link_raw, :safe => true) + end + + def test_auto_link_should_not_sanitize_safe_input + link_raw = %{http://www.rubyonrails.com?id=1&num=2} + assert_equal %{http://www.rubyonrails.com?id=1&num=2}, auto_link(link_raw.html_safe) + end + def test_auto_link_other_protocols ftp_raw = 'ftp://example.com/file.txt' assert_equal %(Download #{generate_result(ftp_raw)}), auto_link("Download #{ftp_raw}") @@ -587,7 +660,12 @@ class TextHelperTest < ActionView::TestCase assert_equal(%w{Specialized Fuji Giant}, @cycles) end + # TODO test textilize_without_paragraph and markdown if defined? RedCloth + def test_textilize_should_be_html_safe + assert textilize("*This is Textile!* Rejoice!").html_safe? + end + def test_textilize assert_equal("

This is Textile! Rejoice!

", textilize("*This is Textile!* Rejoice!")) end @@ -600,6 +678,18 @@ class TextHelperTest < ActionView::TestCase assert_equal("

This is worded <strong>strongly</strong>

", textilize("This is worded strongly", :filter_html)) end + def test_textilize_should_sanitize_unsafe_input + assert_equal("

This is worded strongly

", textilize("This is worded strongly")) + end + + def test_textilize_should_not_sanitize_input_if_safe_option + assert_equal("

This is worded strongly

", textilize("This is worded strongly", :safe)) + end + + def test_textilize_should_not_sanitize_safe_input + assert_equal("

This is worded strongly

", textilize("This is worded strongly".html_safe)) + end + def test_textilize_with_hard_breaks assert_equal("

This is one scary world.
\n True.

", textilize("This is one scary world.\n True.")) end -- cgit v1.2.3 From 981f81275be8e0f38a35c397b41a209b0e14973c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 7 Jun 2010 22:22:54 +0200 Subject: Fix case when rendering a partial inside RJS with inherited layout [#4786 state:resolved] --- actionpack/test/controller/new_base/render_rjs_test.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'actionpack/test') diff --git a/actionpack/test/controller/new_base/render_rjs_test.rb b/actionpack/test/controller/new_base/render_rjs_test.rb index b602b9f8e9..74bf865b54 100644 --- a/actionpack/test/controller/new_base/render_rjs_test.rb +++ b/actionpack/test/controller/new_base/render_rjs_test.rb @@ -2,7 +2,10 @@ require 'abstract_unit' module RenderRjs class BasicController < ActionController::Base + layout "application", :only => :index_respond_to + self.view_paths = [ActionView::FixtureResolver.new( + "layouts/application.html.erb" => "", "render_rjs/basic/index.js.rjs" => "page[:customer].replace_html render(:partial => 'customer')", "render_rjs/basic/index_html.js.rjs" => "page[:customer].replace_html :partial => 'customer'", "render_rjs/basic/index_no_js.js.erb" => "<%= render(:partial => 'developer') %>", -- cgit v1.2.3 From 67a60ee314f53abcde78f8ecd2a1f7c9ef8264e1 Mon Sep 17 00:00:00 2001 From: Diego Carrion Date: Mon, 7 Jun 2010 18:08:48 -0500 Subject: Add shallow routes to the new router [Closes #3765] --- actionpack/test/dispatch/routing_test.rb | 39 ++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'actionpack/test') diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index ffa4f50b00..82c45f3161 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -34,6 +34,33 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest end end + resources :users do + shallow do + resources :photos do + resources :types do + member do + post :preview + end + collection do + delete :erase + end + end + end + end + end + + shallow do + resources :teams do + resources :players + end + + resources :countries do + resources :cities do + resources :places + end + end + end + match 'account/logout' => redirect("/logout"), :as => :logout_redirect match 'account/login', :to => redirect("/login") @@ -728,6 +755,18 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest end end + def test_shallow_routes + with_test_routes do + assert_equal '/photos/4', photo_path(4) + assert_equal '/types/10/edit', edit_type_path(10) + assert_equal '/types/5/preview', preview_type_path(5) + assert_equal '/photos/2/types', photo_types_path(2) + assert_equal '/cities/1/places', url_for(:controller => :places, :action => :index, :city_id => 1, :only_path => true) + assert_equal '/teams/new', url_for(:controller => :teams, :action => :new, :only_path => true) + assert_equal '/photos/11/types/erase', url_for(:controller => :types, :action => :erase, :photo_id => 11, :only_path => true) + end + end + def test_update_project_person with_test_routes do get '/projects/1/people/2/update' -- cgit v1.2.3 From 21cc1ed4370666cdb1944d4591b5663fd6206ae3 Mon Sep 17 00:00:00 2001 From: Mikel Lindsaar Date: Mon, 7 Jun 2010 21:53:31 -0400 Subject: Updating image_tag to support cid:content_id "URLs" --- actionpack/test/template/asset_tag_helper_test.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'actionpack/test') diff --git a/actionpack/test/template/asset_tag_helper_test.rb b/actionpack/test/template/asset_tag_helper_test.rb index b6a6f52876..633641514e 100644 --- a/actionpack/test/template/asset_tag_helper_test.rb +++ b/actionpack/test/template/asset_tag_helper_test.rb @@ -404,6 +404,15 @@ class AssetTagHelperTest < ActionView::TestCase assert_equal %(Rails), image_tag("rails.png") end + def test_image_tag_interpreting_email_cid_correctly + # An inline image has no need for an alt tag to be automatically generated from the cid: + assert_equal '', image_tag("cid:thi%25%25sis@acontentid") + end + + def test_image_tag_interpreting_email_adding_optional_alt_tag + assert_equal 'Image', image_tag("cid:thi%25%25sis@acontentid", :alt => "Image") + end + def test_timebased_asset_id_with_relative_url_root @controller.config.relative_url_root = "/collaboration/hieraki" expected_time = File.stat(File.expand_path(File.dirname(__FILE__) + "/../fixtures/public/images/rails.png")).mtime.to_i.to_s -- cgit v1.2.3 From 67f411c57b98f926d39042ba003cefdba14be603 Mon Sep 17 00:00:00 2001 From: rohit Date: Tue, 8 Jun 2010 12:33:55 +0530 Subject: Fixed textilize_without_paragraph and added tests for it. [#4792 state:resolved] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Valim --- actionpack/test/template/text_helper_test.rb | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'actionpack/test') diff --git a/actionpack/test/template/text_helper_test.rb b/actionpack/test/template/text_helper_test.rb index 9d7106b2e5..8c4711451e 100644 --- a/actionpack/test/template/text_helper_test.rb +++ b/actionpack/test/template/text_helper_test.rb @@ -693,5 +693,37 @@ class TextHelperTest < ActionView::TestCase def test_textilize_with_hard_breaks assert_equal("

This is one scary world.
\n True.

", textilize("This is one scary world.\n True.")) end + + def test_textilize_without_paragraph_should_be_html_safe + textilize_without_paragraph("*This is Textile!* Rejoice!").html_safe? + end + + def test_textilize_without_paragraph + assert_equal("This is Textile! Rejoice!", textilize_without_paragraph("*This is Textile!* Rejoice!")) + end + + def test_textilize_without_paragraph_with_blank + assert_equal("", textilize_without_paragraph("")) + end + + def test_textilize_without_paragraph_with_options + assert_equal("This is worded <strong>strongly</strong>", textilize_without_paragraph("This is worded strongly", :filter_html)) + end + + def test_textilize_without_paragraph_should_sanitize_unsafe_input + assert_equal("This is worded strongly", textilize_without_paragraph("This is worded strongly")) + end + + def test_textilize_without_paragraph_should_not_sanitize_input_if_safe_option + assert_equal("This is worded strongly", textilize_without_paragraph("This is worded strongly", :safe)) + end + + def test_textilize_without_paragraph_should_not_sanitize_safe_input + assert_equal("This is worded strongly", textilize_without_paragraph("This is worded strongly".html_safe)) + end + + def test_textilize_without_paragraph_with_hard_breaks + assert_equal("This is one scary world.
\n True.", textilize_without_paragraph("This is one scary world.\n True.")) + end end end -- cgit v1.2.3 From 4740fbac85d6190cccd244f943d7a578c607b806 Mon Sep 17 00:00:00 2001 From: Andrew White Date: Mon, 5 Apr 2010 06:48:02 +0100 Subject: Add support for actions on a new resource to the new routing DSL [#4328 state:resolved] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Valim --- actionpack/test/dispatch/routing_test.rb | 50 ++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) (limited to 'actionpack/test') diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index 82c45f3161..ecc73f1fbc 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -96,8 +96,17 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest end scope 'pt', :name_prefix => 'pt' do - resources :projects, :path_names => { :edit => 'editar' }, :path => 'projetos' - resource :admin, :path_names => { :new => 'novo' }, :path => 'administrador' + resources :projects, :path_names => { :edit => 'editar', :new => 'novo' }, :path => 'projetos' do + post :preview, :on => :new + end + resource :admin, :path_names => { :new => 'novo' }, :path => 'administrador' do + post :preview, :on => :new + end + resources :products, :path_names => { :new => 'novo' } do + new do + post :preview + end + end end resources :projects, :controller => :project do @@ -146,6 +155,10 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest end resources :replies do + new do + post :preview + end + member do put :answer, :to => :mark_as_answer delete :answer, :to => :unmark_as_answer @@ -234,6 +247,14 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest end match "whatever/:controller(/:action(/:id))" + + resource :profile do + get :settings + + new do + post :preview + end + end end end @@ -1077,6 +1098,31 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest end end + def test_resource_new_actions + with_test_routes do + assert_equal '/replies/new/preview', preview_new_reply_path + assert_equal '/pt/projetos/novo/preview', preview_new_pt_project_path + assert_equal '/pt/administrador/novo/preview', preview_new_pt_admin_path + assert_equal '/pt/products/novo/preview', preview_new_pt_product_path + assert_equal '/profile/new/preview', preview_new_profile_path + + post '/replies/new/preview' + assert_equal 'replies#preview', @response.body + + post '/pt/projetos/novo/preview' + assert_equal 'projects#preview', @response.body + + post '/pt/administrador/novo/preview' + assert_equal 'admins#preview', @response.body + + post '/pt/products/novo/preview' + assert_equal 'products#preview', @response.body + + post '/profile/new/preview' + assert_equal 'profiles#preview', @response.body + end + end + private def with_test_routes yield -- cgit v1.2.3 From 47bf19c8485ecead7280019c4815a2ed4f2161d5 Mon Sep 17 00:00:00 2001 From: rohit Date: Tue, 8 Jun 2010 16:52:48 +0530 Subject: Made markdown honor :safe option and handle safe input. Also added tests for markdown. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [#4794 state:resolved] Signed-off-by: José Valim --- actionpack/test/template/text_helper_test.rb | 36 ++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'actionpack/test') diff --git a/actionpack/test/template/text_helper_test.rb b/actionpack/test/template/text_helper_test.rb index 8c4711451e..64f1d46413 100644 --- a/actionpack/test/template/text_helper_test.rb +++ b/actionpack/test/template/text_helper_test.rb @@ -7,6 +7,12 @@ rescue LoadError $stderr.puts "Skipping textilize tests. `gem install RedCloth` to enable." end +begin + require 'bluecloth' +rescue LoadError + $stderr.puts "Skipping markdown tests. 'gem install bluecloth' to enable." +end + class TextHelperTest < ActionView::TestCase tests ActionView::Helpers::TextHelper include TestingSandbox @@ -726,4 +732,34 @@ class TextHelperTest < ActionView::TestCase assert_equal("This is one scary world.
\n True.", textilize_without_paragraph("This is one scary world.\n True.")) end end + + if defined? BlueCloth + def test_markdown_should_be_html_safe + assert markdown("We are using __Markdown__ now!").html_safe? + end + + def test_markdown + assert_equal("

We are using Markdown now!

", markdown("We are using __Markdown__ now!")) + end + + def test_markdown_with_blank + assert_equal("", markdown("")) + end + + def test_markdown_should_sanitize_unsafe_input + assert_equal("

This is worded strongly

", markdown("This is worded strongly")) + end + + def test_markdown_should_not_sanitize_input_if_safe_option + assert_equal("

This is worded strongly

", markdown("This is worded strongly", :safe)) + end + + def test_markdown_should_not_sanitize_safe_input + assert_equal("

This is worded strongly

", markdown("This is worded strongly".html_safe)) + end + + def test_markdown_with_hard_breaks + assert_equal("

This is one scary world.

\n\n

True.

", markdown("This is one scary world.\n\nTrue.")) + end + end end -- cgit v1.2.3 From a7edddf605d2ffbb6669365dcd23d6e4c6c2cf84 Mon Sep 17 00:00:00 2001 From: Andrew White Date: Tue, 8 Jun 2010 18:00:43 +0100 Subject: Fix resources ignoring scope options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Valim --- actionpack/test/dispatch/routing_test.rb | 34 ++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) (limited to 'actionpack/test') diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index ecc73f1fbc..a294535e88 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -229,10 +229,13 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest root :to => 'projects#index' end - resources :products, :constraints => { :id => /\d{4}/ } do - root :to => "products#root" - get :favorite, :on => :collection - resources :images + scope :only => [:index, :show] do + resources :products, :constraints => { :id => /\d{4}/ } do + root :to => "products#root" + get :favorite, :on => :collection + resources :images + end + resource :account end resource :dashboard, :constraints => { :ip => /192\.168\.1\.\d{1,3}/ } @@ -1123,6 +1126,29 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest end end + def test_resource_merges_options_from_scope + with_test_routes do + assert_raise(NameError) { new_account_path } + + get '/account/new' + assert_equal 404, status + end + end + + def test_resources_merges_options_from_scope + with_test_routes do + assert_raise(NoMethodError) { edit_product_path('1') } + + get '/products/1/edit' + assert_equal 404, status + + assert_raise(NoMethodError) { edit_product_image_path('1', '2') } + + post '/products/1/images/2/edit' + assert_equal 404, status + end + end + private def with_test_routes yield -- cgit v1.2.3 From c6ad64394b927a64a221a89087ec1ea7d666ed55 Mon Sep 17 00:00:00 2001 From: Prem Sichanugrist Date: Sun, 6 Jun 2010 16:56:48 -0400 Subject: Make sure that rails recognized the full notation of IPv6 loopback address, and recognize 127.0.0.0/8 in IPv4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Valim --- actionpack/test/dispatch/show_exceptions_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack/test') diff --git a/actionpack/test/dispatch/show_exceptions_test.rb b/actionpack/test/dispatch/show_exceptions_test.rb index b447b0715c..4966527f4d 100644 --- a/actionpack/test/dispatch/show_exceptions_test.rb +++ b/actionpack/test/dispatch/show_exceptions_test.rb @@ -53,7 +53,7 @@ class ShowExceptionsTest < ActionController::IntegrationTest test "rescue locally from a local request" do @app = ProductionApp - ['127.0.0.1', '::1'].each do |ip_address| + ['127.0.0.1', '127.0.0.127', '::1', '0:0:0:0:0:0:0:1', '0:0:0:0:0:0:0:1%0'].each do |ip_address| self.remote_addr = ip_address get "/", {}, {'action_dispatch.show_exceptions' => true} -- cgit v1.2.3 From 585f8f27b190637fd0bad67d7d611eed5ae262e7 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 7 Jun 2010 20:54:53 -0400 Subject: Fixed double output from cache in no caching mode --- actionpack/test/controller/caching_test.rb | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'actionpack/test') diff --git a/actionpack/test/controller/caching_test.rb b/actionpack/test/controller/caching_test.rb index 4431eb2e2a..c161bea945 100644 --- a/actionpack/test/controller/caching_test.rb +++ b/actionpack/test/controller/caching_test.rb @@ -644,21 +644,6 @@ class FragmentCachingTest < ActionController::TestCase assert_equal 'will not expire ;-)', @store.read('views/primalgrasp') end - def test_fragment_for_with_disabled_caching - @controller.perform_caching = false - - @store.write('views/expensive', 'fragment content') - fragment_computed = false - - view_context = @controller.view_context - - buffer = 'generated till now -> '.html_safe - buffer << view_context.send(:fragment_for, 'expensive') { fragment_computed = true } - - assert fragment_computed - assert_equal 'generated till now -> ', buffer - end - def test_fragment_for @store.write('views/expensive', 'fragment content') fragment_computed = false -- cgit v1.2.3