Sha256: 7335c212398390d193211d45e97cbbbd0f87112fafdc97b39f0aa047f6e09f9c

Contents?: true

Size: 1.35 KB

Versions: 14

Compression:

Stored size: 1.35 KB

Contents

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

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

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

class SpecTagz < Ramaze::Controller
  map '/'
  engine :Tagz
  helper :tagz

  def index
    tagz{ h1_{ "Tagz Index" } }
  end

  def links
    tagz do
      ul_ do
        li_{ a_(:href => r(:index)){ "Index page" } }
        li_{ a_(:href => r(:internal)){ "Internal template" } }
        li_{ a_(:href => r(:external)){ "External template" } }
      end
    end
  end

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

describe Ramaze::View::Tagz do
  behaves_like :rack_test

  should 'use tagz methods' do
    get('/').body.should == '<h1>Tagz Index</h1>'
  end

  should 'use other helper methods' do
    get('/links').body.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.should == "<html><head><title>Tagz Test</title></head><body><h1>Tagz Template</h1></body></html>"
  end

  should 'render external template with instance variables' do
    get('/sum/1/2').body.should == '<div>3</div>'
  end
end

Version data entries

14 entries across 14 versions & 3 rubygems

Version Path
Pistos-ramaze-2009.06.12 spec/ramaze/view/tagz.rb
manveru-ramaze-2009.07 spec/ramaze/view/tagz.rb
ramaze-2011.12.28 spec/ramaze/view/tagz.rb
ramaze-2011.10.23 spec/ramaze/view/tagz.rb
ramaze-2011.07.25 spec/ramaze/view/tagz.rb
ramaze-2011.01.30 spec/ramaze/view/tagz.rb
ramaze-2011.01 spec/ramaze/view/tagz.rb
ramaze-2010.06.18 spec/ramaze/view/tagz.rb
ramaze-2010.04.04 spec/ramaze/view/tagz.rb
ramaze-2010.04 spec/ramaze/view/tagz.rb
ramaze-2010.03 spec/ramaze/view/tagz.rb
ramaze-2010.01 spec/ramaze/view/tagz.rb
ramaze-2009.10 spec/ramaze/view/tagz.rb
ramaze-2009.07 spec/ramaze/view/tagz.rb