Sha256: a16b920d4f830651c37160df0b26caf028af764f90a19bfe1ae69bd50d34e1d9

Contents?: true

Size: 1.27 KB

Versions: 2

Compression:

Stored size: 1.27 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'
testcase_requires 'nagoro'

class TCTemplateNagoroController < Ramaze::Controller
  map :/
  template_root __DIR__/:nagoro
  engine :Nagoro

  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 "Nagoro" do
  before(:all) do
    ramaze
  end

  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

2 entries across 2 versions & 1 rubygems

Version Path
ramaze-0.2.1 spec/ramaze/template/nagoro.rb
ramaze-0.2.0 spec/ramaze/template/nagoro.rb