Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added a test

  • Loading branch information...
commit 3f78683f099aff8cc1c3a18c28639277e3d18b59 1 parent 25d9463
Tyler Collier authored
Showing with 20 additions and 0 deletions.
  1. +20 −0 spec/letter_opener/delivery_method_spec.rb
View
20 spec/letter_opener/delivery_method_spec.rb
@@ -62,5 +62,25 @@
text = File.read(Dir["#{@location}/*/plain.html"].first)
text.should include(File.basename(__FILE__))
end
+
+ it "replaces inline attachment urls" do
+ mail = Mail.deliver do
+ from 'foo@example.com'
+ to 'bar@example.com'
+ subject 'With attachments'
+ attachments[File.basename(__FILE__)] = File.read(__FILE__)
+ url = attachments[0].url
+ html_part do
+ content_type 'text/html; charset=UTF-8'
+ body "Here's an image: <img src='#{url}' />"
+ end
+ end
+ attachment_path = Dir["#{@location}/*/attachments/#{File.basename(__FILE__)}"].first
+ File.exists?(attachment_path).should == true
+ text = File.read(Dir["#{@location}/*/rich.html"].first)
+ mail.parts[0].body.should include(mail.attachments[0].url)
+ text.should_not include(mail.attachments[0].url)
+ text.should include("attachments/#{File.basename(__FILE__)}")
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.