Sha256: ded3cd5dcd6aa324fa0f8df5cb35a3a02c99ccccdedddda1fff43aeb9c9dd427

Contents?: true

Size: 736 Bytes

Versions: 19

Compression:

Stored size: 736 Bytes

Contents

require 'minitest_helper'

describe Rasti::Web::Template do

  class Context
    include ContextMethodHelper
  end
  
  it 'Plain HTML' do
    Rasti::Web::Template.render('plain_html').must_equal '<div>Hello world</div>'
  end

  it 'Context method' do
    Rasti::Web::Template.render('context_method', Context.new).must_equal '<h1>Hello world</h1>'
  end

  it 'Local variable' do
    Rasti::Web::Template.render('local_variable', nil, text: 'Welcome').must_equal '<h1>Welcome</h1>'
  end

  it 'Invalid template' do
    proc { Rasti::Web::Template.render 'invalid' }.must_raise RuntimeError
  end

  it 'Nested' do
    Rasti::Web::Template.render('layout') { 'inner text' }.must_equal '<html><body>inner text</body></html>'
  end

end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
rasti-web-2.0.1 spec/template_spec.rb
rasti-web-2.0.0 spec/template_spec.rb
rasti-web-1.2.1 spec/template_spec.rb
rasti-web-1.2.0 spec/template_spec.rb
rasti-web-1.1.0 spec/template_spec.rb
rasti-web-1.0.0 spec/template_spec.rb
rasti-web-0.2.3 spec/template_spec.rb
rasti-web-0.2.2 spec/template_spec.rb
rasti-web-0.2.1 spec/template_spec.rb
rasti-web-0.2.0 spec/template_spec.rb
rasti-web-0.1.1 spec/template_spec.rb
rasti-web-0.1.0 spec/template_spec.rb
rasti-web-0.0.7 spec/template_spec.rb
rasti-web-0.0.6 spec/template_spec.rb
rasti-web-0.0.5 spec/template_spec.rb
rasti-web-0.0.4 spec/template_spec.rb
rasti-web-0.0.3 spec/template_spec.rb
rasti-web-0.0.2 spec/template_spec.rb
rasti-web-0.0.1 spec/template_spec.rb