# Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com
# All files in this distribution are subject to the terms of the MIT license.
require File.expand_path('../../../../spec/helper', __FILE__)
spec_require 'liquid'
Ramaze::App.options.views = 'liquid'
class SpecLiquid < Ramaze::Controller
map '/'
engine :Liquid
def index
'
Liquid Index
'
end
def links
'
- {% anchor "Index page" index %}
- {% anchor "Internal template" internal %}
- {% anchor "External template" external %}
'.ui
end
def sum(num1, num2)
@sum = num1.to_i + num2.to_i
end
end
describe 'Ramaze::View::Liquid' do
behaves_like :rack_test
should 'render' do
got = get('/')
got.status.should == 200
got['Content-Type'].should == 'text/html'
got.body.strip.should == "Liquid Index
"
end
should 'use custom tags for default helpers' do
got = get('/links')
got.status.should == 200
got['Content-Type'].should == 'text/html'
got.body.strip.should ==
''.ui
end
should 'render external template' do
got = get('/external')
got.status.should == 200
got['Content-Type'].should == 'text/html'
got.body.strip.should ==
"
Liquid Test
Liquid Template
"
end
should 'render external template with instance variables' do
got = get('/sum/1/2')
got.status.should == 200
got['Content-Type'].should == 'text/html'
got.body.strip.should == "3
"
end
end