Skip to content
This repository
Browse code

Added tests for config.action_controller.perform_caching

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
  • Loading branch information...
commit 90594721779e1d3ab103989fb7d0a7c343b88662 1 parent 0e27463
Chetan Sarva authored April 13, 2010 jeremy committed April 13, 2010
36  railties/test/application/configuration_test.rb
@@ -285,5 +285,41 @@ def index
285 285
       get "/"
286 286
       assert last_response.body =~ /csrf\-param/
287 287
     end
  288
+
  289
+    test "config.action_controller.perform_caching = true" do
  290
+        make_basic_app do |app|
  291
+          app.config.action_controller.perform_caching = true
  292
+        end
  293
+
  294
+      class ::OmgController < ActionController::Base
  295
+        caches_action :index
  296
+        def index
  297
+          render :text => rand(1000)
  298
+        end
  299
+      end
  300
+
  301
+      get "/"
  302
+      res = last_response.body
  303
+      get "/"
  304
+      assert_equal res, last_response.body # value should be unchanged
  305
+    end
  306
+
  307
+    test "config.action_controller.perform_caching = false" do
  308
+      make_basic_app do |app|
  309
+        app.config.action_controller.perform_caching = false
  310
+      end
  311
+
  312
+      class ::OmgController < ActionController::Base
  313
+        caches_action :index
  314
+        def index
  315
+          render :text => rand(1000)
  316
+        end
  317
+      end
  318
+
  319
+      get "/"
  320
+      res = last_response.body
  321
+      get "/"
  322
+      assert_not_equal res, last_response.body
  323
+    end
288 324
   end
289 325
 end

0 notes on commit 9059472

Please sign in to comment.
Something went wrong with that request. Please try again.