Sha256: d8026a167b45b14ea5e7d0fc053bac8b5c8de04a513ea5a62a62df4ff42e1686

Contents?: true

Size: 1.23 KB

Versions: 10

Compression:

Stored size: 1.23 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'

class TCTemplateController < Ramaze::Controller
  map :/
  view_root __DIR__(:ezamar)
  engine :Ezamar

  def index text
    @text = text
  end

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

  def nested key, value
    instance_variable_set("@#{key}", value)
  end

  def internal *args
    @args = args
    '<?r i = 2 ?>#{i * i} #{@args.inspect} on the table'
  end

  def combined
    @a = 'boo'
  end
end


describe "Ezamar" do
  behaves_like 'http'
  ramaze

  it "hello world" do
    get('/World').body.should == 'Hello, World!'
    get('/You').body.should == 'Hello, You!'
  end

  it "summing" do
    get('/sum/1/2').body.should == '3'
  end

  it "nasty nested stuff" do
    get('/nested/foo/bar').body.should == 'bar'
  end

  it "template inside controller" do
    get('/internal').body.should == '4 [] on the table'
    get('/internal/foo').body.should == '4 ["foo"] on the table'
  end

  it "without method" do
    get('/file_only').body.should == "This is only the file"
  end

  it "combined" do
    get('/combined').body.should == 'boo'
  end
end

Version data entries

10 entries across 10 versions & 4 rubygems

Version Path
Pistos-ramaze-2008.12 spec/ramaze/template/ezamar.rb
Pistos-ramaze-2009.01 spec/ramaze/template/ezamar.rb
Pistos-ramaze-2009.02 spec/ramaze/template/ezamar.rb
manveru-ramaze-2008.12 spec/ramaze/template/ezamar.rb
manveru-ramaze-2009.01 spec/ramaze/template/ezamar.rb
ptomato-ramaze-2009.02.1 spec/ramaze/template/ezamar.rb
ptomato-ramaze-2009.02 spec/ramaze/template/ezamar.rb
ramaze-2009.01 spec/ramaze/template/ezamar.rb
ramaze-2009.02 spec/ramaze/template/ezamar.rb
ramaze-2009.03 spec/ramaze/template/ezamar.rb