Specify the full path to the NEWLINE constant

This commit is contained in:
Matt Simpson 2013-12-28 19:43:59 -06:00
parent bbfbcf7583
commit 21f575af3a
2 changed files with 20 additions and 1 deletions

View file

@ -0,0 +1,19 @@
Feature: select_tag helper
Scenario: select_tag produces correct options
Given a fixture app "indexable-app"
And an empty file named "config.rb"
And a file named "source/select_tag.html.erb" with:
"""
options as array: <%= select_tag :colors, options: ["red", "blue", "blorange"], include_blank: "Choose a color" %>
"""
And the Server is running at "indexable-app"
When I go to "/select_tag.html"
Then I should see:
"""
<select name="colors"><option value="">Choose a color</option>
<option value="red">red</option>
<option value="blue">blue</option>
<option value="blorange">blorange</option>
</select>
"""

View file

@ -49,7 +49,7 @@ class Middleman::CoreExtensions::DefaultHelpers < ::Middleman::Extension
output = ActiveSupport::SafeBuffer.new output = ActiveSupport::SafeBuffer.new
output.safe_concat "<#{name}#{attributes}>" output.safe_concat "<#{name}#{attributes}>"
if content.respond_to?(:each) && !content.is_a?(String) if content.respond_to?(:each) && !content.is_a?(String)
content.each { |c| output.safe_concat c; output.safe_concat NEWLINE } content.each { |c| output.safe_concat c; output.safe_concat ::Padrino::Helpers::TagHelpers::NEWLINE }
else else
output.safe_concat "#{content}" output.safe_concat "#{content}"
end end