File: etanni.rb

package info (click to toggle)
libinnate-ruby 2010.07-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 812 kB
  • ctags: 621
  • sloc: ruby: 4,242; makefile: 2
file content (27 lines) | stat: -rw-r--r-- 823 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
require File.expand_path('../../helper', __FILE__)
require 'innate/view/etanni'

describe Etanni = Innate::Etanni do
  it 'renders a simple template' do
    etanni = Etanni.new('Hello, World!')
    etanni.result(self).should == 'Hello, World!'
  end

  it 'allows use of Etanni::SEPARATOR inside interplated code' do
    etanni = Etanni.new('Hello #{@name}')
    @name = "\n#{Etanni::SEPARATOR}\n"
    etanni.result(self).should == "Hello #{@name}"
  end

  it 'fails with SyntaxError or NameError when the SEPARATOR is used inside a template' do
    lambda{
      etanni = Etanni.new("Hello \n#{Etanni::SEPARATOR}\n")
      etanni.result(self)
    }.should.raise NameError

    lambda{
      etanni = Etanni.new("<h1>Hello \n#{Etanni::SEPARATOR}\n</h1>")
      etanni.result(self)
    }.should.raise SyntaxError
  end
end