Sha256: b294b5e92cca126fd5a95233df410f1dfda217284845226d95f43f3d5c22e291

Contents?: true

Size: 759 Bytes

Versions: 10

Compression:

Stored size: 759 Bytes

Contents

require 'test_helper'

# TODO: assert that same-named cells and widgets don't overwrite their caches.

class CachingTest < ActiveSupport::TestCase
  include Apotomo::TestCaseMethods::TestController
  
  class CheeseWidget < Apotomo::Widget
    cache :holes
    
    def holes(count)
      render :text => count
    end 
  end
  
  context "A caching widget" do
    setup do
      ActionController::Base.perform_caching = true
      @cheese = CheeseWidget.new(parent_controller, 'cheese', :holes)
    end
    
    teardown do
      ActionController::Base.perform_caching = false
    end
    
    should "invoke the cached state only once" do
      assert_equal "1", @cheese.invoke(:holes, 1)
      assert_equal "1", @cheese.invoke(:holes, 2)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
apotomo-1.2.3 test/rails/caching_test.rb
apotomo-1.2.2 test/rails/caching_test.rb
apotomo-1.2.1 test/rails/caching_test.rb
apotomo-1.2.0 test/rails/caching_test.rb
apotomo-1.1.4 test/rails/caching_test.rb
apotomo-1.1.3 test/rails/caching_test.rb
apotomo-1.1.2 test/rails/caching_test.rb
apotomo-1.1.1 test/rails/caching_test.rb
apotomo-1.1.0 test/rails/caching_test.rb
apotomo-1.1.0.rc1 test/rails/caching_test.rb