156 |
156 |
end
|
157 |
157 |
|
158 |
158 |
def test_attached_images_with_textile_and_non_ascii_filename
|
159 |
|
attachment = Attachment.generate!(:filename => 'café.jpg')
|
|
159 |
to_test = {
|
|
160 |
'CAFÉ.JPG' => 'CAF%C3%89.JPG',
|
|
161 |
'crème.jpg' => 'cr%C3%A8me.jpg',
|
|
162 |
}
|
160 |
163 |
with_settings :text_formatting => 'textile' do
|
161 |
|
assert_include %(<img src="/attachments/download/#{attachment.id}/caf%C3%A9.jpg" alt="" />),
|
162 |
|
textilizable("!café.jpg!)", :attachments => [attachment])
|
|
164 |
to_test.each do |filename, result|
|
|
165 |
attachment = Attachment.generate!(:filename => filename)
|
|
166 |
assert_include %(<img src="/attachments/download/#{attachment.id}/#{result}" alt="" />), textilizable("!#{filename}!", :attachments => [attachment])
|
|
167 |
end
|
163 |
168 |
end
|
164 |
169 |
end
|
165 |
170 |
|
166 |
171 |
def test_attached_images_with_markdown_and_non_ascii_filename
|
167 |
172 |
skip unless Object.const_defined?(:Redcarpet)
|
168 |
173 |
|
169 |
|
attachment = Attachment.generate!(:filename => 'café.jpg')
|
|
174 |
to_test = {
|
|
175 |
'CAFÉ.JPG' => 'CAF%C3%89.JPG',
|
|
176 |
'crème.jpg' => 'cr%C3%A8me.jpg',
|
|
177 |
}
|
170 |
178 |
with_settings :text_formatting => 'markdown' do
|
171 |
|
assert_include %(<img src="/attachments/download/#{attachment.id}/caf%C3%A9.jpg" alt="" />),
|
172 |
|
textilizable("![](café.jpg)", :attachments => [attachment])
|
|
179 |
to_test.each do |filename, result|
|
|
180 |
attachment = Attachment.generate!(:filename => filename)
|
|
181 |
assert_include %(<img src="/attachments/download/#{attachment.id}/#{result}" alt="" />), textilizable("![](#{filename})", :attachments => [attachment])
|
|
182 |
end
|
173 |
183 |
end
|
174 |
184 |
end
|
175 |
185 |
|