Sha256: 8684641c1704d4d95f84acdd9a9b2061d93dadd506e5cde716910e6a142bc621

Contents?: true

Size: 774 Bytes

Versions: 13

Compression:

Stored size: 774 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 LoadError
  warn "#{$!.to_s}: skipping textile tests"
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
sinatra-1.2.9 test/textile_test.rb
sinatra-1.2.8 test/textile_test.rb
sinatra-1.2.7 test/textile_test.rb
sinatra-1.2.6 test/textile_test.rb
sinatra-1.3.0.c test/textile_test.rb
sinatra-1.2.3 test/textile_test.rb
sinatra-1.2.2 test/textile_test.rb
sinatra-1.3.0.b test/textile_test.rb
sinatra-1.3.0.a test/textile_test.rb
sinatra-1.2.1 test/textile_test.rb
sinatra-1.2.0 test/textile_test.rb
sinatra-1.2.0.d test/textile_test.rb
sinatra-1.2.0.c test/textile_test.rb