Sha256: 98cce3507d646e034c80c0ee9624b28a9defb54a5c11a7bdd8b31343df091f8f

Contents?: true

Size: 820 Bytes

Versions: 4

Compression:

Stored size: 820 Bytes

Contents

require 'spec/helper'

class TCActionCache < Ramaze::Controller
  map '/'
  helper :cache

  def index
    rand
  end
  cache :index
end

class TCOtherCache < Ramaze::Controller
  map '/other'
  helper :cache

  def index
    rand
  end
  cache :index
end

describe 'Action rendering' do
  behaves_like 'http'

  @public_root = __DIR__ / :public
  FileUtils.mkdir_p @public_root
  ramaze :file_cache => true

  def req(path) r = get(path); [r.content_type, r.body] end

  it 'should cache to file' do
    lambda{ req('/') }.should.not.change{ req('/') }
    File.file?(@public_root/'index').should == true
  end

  it 'should create subdirs as needed' do
    lambda{ req('/other') }.should.not.change{ req('/other') }
    File.file?(@public_root/'other'/'index').should == true
  end

  FileUtils.rm_rf @public_root
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ramaze-0.3.0 spec/ramaze/action/cache.rb
ramaze-0.3.5 spec/ramaze/action/cache.rb
ramaze-0.3.9 spec/ramaze/action/cache.rb
ramaze-0.3.9.1 spec/ramaze/action/cache.rb