Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

test both ERB and Erubis

  • Loading branch information...
commit b3e82c5293e30b238a93bbaf1d9096e7dbb05b7e 1 parent 8f76d3b
@rkh rkh authored
Showing with 23 additions and 0 deletions.
  1. +23 −0 test/erb_test.rb
View
23 test/erb_test.rb
@@ -1,6 +1,15 @@
require File.dirname(__FILE__) + '/helper'
class ERBTest < Test::Unit::TestCase
+ def engine
+ Tilt::ERBTemplate
+ end
+
+ def setup
+ Tilt.prefer engine, :erb
+ super
+ end
+
def erb_app(&block)
mock_app {
set :views, File.dirname(__FILE__) + '/views'
@@ -9,6 +18,10 @@ def erb_app(&block)
get '/'
end
+ it 'uses the correct engine' do
+ assert_equal engine, Tilt[:erb]
+ end
+
it 'renders inline ERB strings' do
erb_app { erb '<%= 1 + 1 %>' }
assert ok?
@@ -79,3 +92,13 @@ def is; "IS." end
assert_equal '<outer><inner>hi</inner></outer>', body
end
end
+
+
+begin
+ require 'erubis'
+ class ErubisTest < ERBTest
+ def engine; Tilt::ErubisTemplate end
+ end
+rescue LoadError
+ warn "#{$!.to_s}: skipping erubis tests"
+end
Please sign in to comment.
Something went wrong with that request. Please try again.