rf = Regexp.new(filename, Regexp::IGNORECASE)
# search for the picture in attachments
if found = attachments.detect { |att| att.filename =~ rf }
- image_url = url_for :only_path => only_path, :controller => 'attachments', :action => 'download', :id => found.id
- "!#{style}#{image_url}!"
+ image_url = url_for :only_path => only_path, :controller => 'attachments', :action => 'download', :id => found
+ desc = found.description.to_s.gsub(/^([^\(\)]*).*$/, "\\1")
+ alt = desc.blank? ? nil : "(#{desc})"
+ "!#{style}#{image_url}#{alt}!"
else
"!#{style}#{filename}!"
end
assert_tag :tag => 'h1', :content => /Another page/
# Included page with an inline image
assert_tag :tag => 'p', :content => /This is an inline image/
- assert_tag :tag => 'img', :attributes => { :src => '/attachments/download/3' }
+ assert_tag :tag => 'img', :attributes => { :src => '/attachments/download/3',
+ :alt => 'This is a logo' }
end
def test_show_unexistent_page_without_edit_right