# 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_requires 'erubis', 'redcloth'
Ramaze::App.options.views = 'redcloth'
class SpecRedCloth < Ramaze::Controller
map '/'
engine :RedCloth
def index
'h1. RedCloth Index'
end
def links
'
- <%= a("Index page", :index) %>
- <%= a("Internal template", :internal) %>
- <%= a("External template", :external) %>
'.ui
end
def internal
"h2. <%= 1 + 1 %>"
end
end
describe "Ramaze::View::RedCloth" do
behaves_like :rack_test
should 'render' do
got = get('/')
got.status.should == 200
got['Content-Type'].should == 'text/html'
got.body.should == 'RedCloth Index
'
end
it "uses helper methods" do
got = get('/links')
got.status.should == 200
got['Content-Type'].should == 'text/html'
got.body.strip.should ==
''
end
it 'renders external templates' do
got = get('/external')
got.status.should == 200
got['Content-Type'].should == 'text/html'
got.body.strip.should ==
"
Erubis Test
RedCloth Template
"
end
end