mirror of
https://github.com/sinatra/sinatra
synced 2023-03-27 23:18:01 -04:00
Fix issue setting content_for value with method param
This commit is contained in:
parent
9fef844f06
commit
4396f1e6a8
6 changed files with 10 additions and 2 deletions
|
@ -97,8 +97,7 @@ module Sinatra
|
|||
result = block[*args]
|
||||
elsif current_engine == :erb || current_engine == :slim
|
||||
@_out_buf, _buf_was = '', @_out_buf
|
||||
block[*args]
|
||||
result = eval('@_out_buf', block.binding)
|
||||
result = block.call(*args)
|
||||
@_out_buf = _buf_was
|
||||
else
|
||||
buffer = eval '_buf if defined?(_buf)', block.binding
|
||||
|
|
1
sinatra-contrib/spec/content_for/parameter_value.erb
Normal file
1
sinatra-contrib/spec/content_for/parameter_value.erb
Normal file
|
@ -0,0 +1 @@
|
|||
<% content_for :foo, 'foo' %>
|
1
sinatra-contrib/spec/content_for/parameter_value.erubis
Normal file
1
sinatra-contrib/spec/content_for/parameter_value.erubis
Normal file
|
@ -0,0 +1 @@
|
|||
<% content_for :foo, 'foo' %>
|
1
sinatra-contrib/spec/content_for/parameter_value.haml
Normal file
1
sinatra-contrib/spec/content_for/parameter_value.haml
Normal file
|
@ -0,0 +1 @@
|
|||
- content_for :foo, 'foo'
|
1
sinatra-contrib/spec/content_for/parameter_value.slim
Normal file
1
sinatra-contrib/spec/content_for/parameter_value.slim
Normal file
|
@ -0,0 +1 @@
|
|||
- content_for :foo, 'foo'
|
|
@ -210,6 +210,11 @@ describe Sinatra::ContentFor do
|
|||
expect(body).to eq("bar")
|
||||
end
|
||||
|
||||
it 'renders content set as parameter' do
|
||||
expect(get('/parameter_value')).to be_ok
|
||||
expect(body).to eq("foo")
|
||||
end
|
||||
|
||||
it 'renders blocks declared with the same key you use when rendering' do
|
||||
expect(get('/same_key')).to be_ok
|
||||
expect(body).to eq("foo")
|
||||
|
|
Loading…
Reference in a new issue