Sha256: 971ab7ce6bfabcfda2f1b226a54b5aec62261457f01ba1786ec099157833cae7

Contents?: true

Size: 728 Bytes

Versions: 6

Compression:

Stored size: 728 Bytes

Contents

require 'test_helper'

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

class CachingTest < MiniTest::Spec
  include Apotomo::TestCaseMethods::TestController

  class CheeseWidget < Apotomo::Widget
    cache :holes

    def holes(count)
      render :text => count
    end
  end

  describe "A caching widget" do
    before do
      ActionController::Base.perform_caching = true
      @cheese = CheeseWidget.new(parent_controller, 'cheese', :holes)
    end

    after do
      ActionController::Base.perform_caching = false
    end

    it "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

6 entries across 6 versions & 1 rubygems

Version Path
apotomo-1.3.2 test/rails/caching_test.rb
apotomo-1.3.1 test/rails/caching_test.rb
apotomo-1.3.0 test/rails/caching_test.rb
apotomo-1.2.6 test/rails/caching_test.rb
apotomo-1.2.5 test/rails/caching_test.rb
apotomo-1.2.4 test/rails/caching_test.rb