Sha256: 00f8de4003c7722b1c11dd653d473fddc577b0d990f4429c20b616ea2bc669d6

Contents?: true

Size: 1.46 KB

Versions: 11

Compression:

Stored size: 1.46 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_requires 'erubis', 'redcloth'

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

class SpecRedCloth < Ramaze::Controller
  map '/'
  engine :RedCloth

  def index
    'h1. RedCloth Index'
  end

  def links
    '<ul>
      <li><%= a("Index page", :index) %></li>
      <li><%= a("Internal template", :internal) %></li>
      <li><%= a("External template", :external) %></li>
    </ul>'.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 == '<h1>RedCloth Index</h1>'
  end

  it "uses helper methods" do
    got = get('/links')
    got.status.should == 200
    got['Content-Type'].should == 'text/html'
    got.body.strip.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

  it 'renders external templates' do
    got = get('/external')
    got.status.should == 200
    got['Content-Type'].should == 'text/html'
    got.body.strip.should ==
"<html>
<head>
    <title>Erubis Test</title>
</head>
<body>
<h1>RedCloth Template</h1>
</body>
</html>"
  end
end

Version data entries

11 entries across 11 versions & 3 rubygems

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