Tests for specifying path/line added
This commit is contained in:
parent
2330449a0d
commit
73c182cfb1
|
@ -100,6 +100,28 @@ class TemplatesTest < Minitest::Test
|
||||||
assert_equal 'Hello World', body
|
assert_equal 'Hello World', body
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'allows to specify path/line when rendering with String' do
|
||||||
|
path = 'example.txt'
|
||||||
|
line = 228
|
||||||
|
begin render_app {
|
||||||
|
render :erb, '<%= doesnotexist %>', {:path => path, :line => line}
|
||||||
|
}
|
||||||
|
rescue NameError => e
|
||||||
|
assert_match(/#{path}:#{line}/, e.backtrace.first)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'allows to specify path/line when rendering with Proc' do
|
||||||
|
path = 'example.txt'
|
||||||
|
line = 900
|
||||||
|
begin render_app {
|
||||||
|
render :erb, Proc.new { '<%= doesnotexist %>' }, {:path => path, :line => line}
|
||||||
|
}
|
||||||
|
rescue NameError => e
|
||||||
|
assert_match(/#{path}:#{line}/, e.backtrace.first)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
it 'renders Proc templates using the call result' do
|
it 'renders Proc templates using the call result' do
|
||||||
render_app { render(:test, Proc.new {'Hello World'}) }
|
render_app { render(:test, Proc.new {'Hello World'}) }
|
||||||
assert ok?
|
assert ok?
|
||||||
|
|
Loading…
Reference in New Issue