Sha256: a3fcf04a7ba0be855409ca5c4dea0d173d2931879e5475d2a3c62196c256a376

Contents?: true

Size: 1.26 KB

Versions: 5

Compression:

Stored size: 1.26 KB

Contents

#          Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com
# All files in this distribution are subject to the terms of the MIT license.

require File.expand_path('../../../../spec/helper', __FILE__)
spec_require 'tenjin'

Ramaze::App.options.views = 'tenjin'

class SpecTenjin < Ramaze::Controller
  map '/'
  engine :Tenjin

  def index
    '<h1>Tenjin Index</h1>'
  end

  def links
    '<ul>
      <li><a href="#{r(:index)}">Index page</a></li>
      <li><a href="#{r(:internal)}">Internal template</a></li>
      <li><a href="#{r(:external)}">External template</a></li>
    </ul>'.ui
  end

  def sum(num1, num2)
    @num1, @num2 = num1.to_i, num2.to_i
  end
end

describe 'Ramaze::View::Tenjin' do
  behaves_like :rack_test

  should 'render' do
    get('/').body.should == '<h1>Tenjin Index</h1>'
  end

  should 'use other helper methods' do
    get('/links').body.strip.
      should == '<ul>
  <li><a href="/index">Index page</a></li>
  <li><a href="/internal">Internal template</a></li>
  <li><a href="/external">External template</a></li>
</ul>'
  end

  should 'render external template' do
    get('/external').body.strip.
    should == '<html>
  <head>
    <title>Tenjin Test</title>
  </head>
  <body>
    <h1>Tenjin Template</h1>
  </body>
</html>'
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ramaze-2023.01.06 spec/ramaze/view/tenjin.rb
ramaze-2012.12.08 spec/ramaze/view/tenjin.rb
ramaze-2012.12.08b spec/ramaze/view/tenjin.rb
ramaze-2012.04.14 spec/ramaze/view/tenjin.rb
ramaze-2012.03.07 spec/ramaze/view/tenjin.rb