Skip to content
Browse files

Added test for attachments

  • Loading branch information...
1 parent c669c82 commit 4eceead787d81b01819e481c1d7b36f13c5820c7 @davidcornu committed May 10, 2012
Showing with 16 additions and 0 deletions.
  1. +16 −0 spec/letter_opener/delivery_method_spec.rb
View
16 spec/letter_opener/delivery_method_spec.rb
@@ -46,5 +46,21 @@
html.should include("View plain text version")
html.should include("<h1>This is HTML</h1>")
end
+
+ it "saves attachments into a seperate directory" do
+ mail = Mail.deliver do
+ from 'foo@example.com'
+ to 'bar@example.com'
+ subject 'With attachments'
+ text_part do
+ body 'This is <plain> text'
+ end
+ attachments[File.basename(__FILE__)] = File.read(__FILE__)
+ end
+ attachment_path = Dir["#{@location}/*/attachments/#{File.basename(__FILE__)}"].first
+ File.exists?(attachment_path).should == true
+ text = File.read(Dir["#{@location}/*/plain.html"].first)
+ text.should include(File.basename(__FILE__))
+ end
end

0 comments on commit 4eceead

Please sign in to comment.
Something went wrong with that request. Please try again.