Sha256: c8e44343cc1324c14a12e408dd1cb7607dce43ce1e6c6315b0a2f0785b861e8b

Contents?: true

Size: 1.07 KB

Versions: 8

Compression:

Stored size: 1.07 KB

Contents

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

require 'spec/helper'

spec_require 'amrita2'

class TCTemplateAmritaController < Ramaze::Controller
  view_root __DIR__/:amrita2
  engine :Amrita2

  def internal
    @data = { :hello => "hello world" }
    "<h1 am:src='hello' />"
  end

  def external
    @data = {
      :title => "hello world",
      :body => "Amrita2 is an HTML template library for Ruby"
    }
  end

  def sum
    @data = { :one => 1, :two => 2 }
  end
end

describe "Simply calling" do
  behaves_like 'http'
  ramaze(:mapping => {'/' => TCTemplateAmritaController})

  it "should respond to /internal" do
    get('/internal').body.strip.should == "<h1>hello world</h1>"
  end

  it "should respond to /external" do
    get('/external').body.strip.should ==
%{<html>
  <body>
    <h1>hello world</h1>
    <p>Amrita2 is an HTML template library for Ruby</p>
  </body>
</html>}
  end

  it "should respond to /sum" do
    get('/sum').body.strip.should == "1 + 2 = 3"
  end
end

Version data entries

8 entries across 8 versions & 4 rubygems

Version Path
Pistos-ramaze-2008.09 spec/ramaze/template/amrita2.rb
clivecrous-ramaze-0.3.9.5 spec/ramaze/template/amrita2.rb
manveru-ramaze-2008.07 spec/ramaze/template/amrita2.rb
manveru-ramaze-2008.08 spec/ramaze/template/amrita2.rb
manveru-ramaze-2008.09 spec/ramaze/template/amrita2.rb
manveru-ramaze-2008.10 spec/ramaze/template/amrita2.rb
ramaze-2008.11 spec/ramaze/template/amrita2.rb
ramaze-2008.06 spec/ramaze/template/amrita2.rb