Sha256: e2847a470bf02a2116637cc26a04f56de7bfcc7db339b42743265f0061ed876d

Contents?: true

Size: 902 Bytes

Versions: 2

Compression:

Stored size: 902 Bytes

Contents

require 'test_helper'


class TemplatesTest < MiniTest::Spec
  Templates = Cell::Templates

  # existing.
  it { Templates.new[['test/fixtures/bassist'], 'play', 'erb'].file.must_equal 'test/fixtures/bassist/play.erb' }

  # not existing.
  it { Templates.new[['test/fixtures/bassist'], 'not-here', 'erb'].must_equal nil }


  # different caches for different classes

  # same cache for subclasses

end


class TemplatesCachingTest < MiniTest::Spec
  class SongCell < Cell::ViewModel
    self.view_paths = ['test/fixtures']

    def show
      render
    end
  end

  # templates are cached once and forever.
  it do
    cell = cell("templates_caching_test/song")

    cell.call(:show).must_equal 'The Great Mind Eraser'

    SongCell.templates.instance_eval do
      def create; raise; end
    end

    # cached, NO new tilt template.
    cell.call(:show).must_equal 'The Great Mind Eraser'
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cells-4.0.0.beta5 test/templates_test.rb
cells-4.0.0.beta4 test/templates_test.rb