Sha256: 3e17d6512a255c3f81cffffaa22753c73b35767227315f47c2aa686171113180

Contents?: true

Size: 763 Bytes

Versions: 7

Compression:

Stored size: 763 Bytes

Contents

require File.dirname(__FILE__) + '/helper'

begin
require 'redcloth'

class TextileTest < Test::Unit::TestCase
  def textile_app(&block)
    mock_app do
      set :views, File.dirname(__FILE__) + '/views'
      get '/', &block
    end
    get '/'
  end

  it 'renders inline textile strings' do
    textile_app { textile 'h1. Hiya' }
    assert ok?
    assert_equal "<h1>Hiya</h1>", body
  end

  it 'renders .textile files in views path' do
    textile_app { textile :hello }
    assert ok?
    assert_equal "<h1>Hello From Textile</h1>", body
  end

  it "raises error if template not found" do
    mock_app { get('/') { textile :no_such_template } }
    assert_raise(Errno::ENOENT) { get('/') }
  end
end
rescue
  warn "#{$!.to_s}: skipping textile tests"
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sinatra-1.1.4 test/textile_test.rb
sinatra-1.1.3 test/textile_test.rb
sinatra-1.1.2 test/textile_test.rb
sinatra-1.2.0.a test/textile_test.rb
sinatra-1.1.0 test/textile_test.rb
sinatra-1.1.b test/textile_test.rb
sinatra-1.1.a test/textile_test.rb