Sha256: f1d5294ec6f2e0765dfec029b970830952e7ecea678e41e5f70d502be1e5c540

Contents?: true

Size: 963 Bytes

Versions: 15

Compression:

Stored size: 963 Bytes

Contents

require 'test_helper'


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

  # existing.
  it { Templates.new[['test/fixtures/bassist'], 'play.erb', {template_class: Cell::Erb::Template}].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']
    # include Cell::Erb

    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

15 entries across 15 versions & 1 rubygems

Version Path
cells-4.1.6 test/templates_test.rb
cells-4.1.5 test/templates_test.rb
cells-4.1.4 test/templates_test.rb
cells-4.1.3 test/templates_test.rb
cells-4.1.2 test/templates_test.rb
cells-4.1.1 test/templates_test.rb
cells-4.1.0 test/templates_test.rb
cells-4.1.0.rc1 test/templates_test.rb
cells-4.0.5 test/templates_test.rb
cells-4.0.4 test/templates_test.rb
cells-4.0.3 test/templates_test.rb
cells-4.0.2 test/templates_test.rb
cells-4.0.1 test/templates_test.rb
cells-4.0.0 test/templates_test.rb
cells-4.0.0.rc1 test/templates_test.rb