Permalink
Browse files

Added test for attachments

  • Loading branch information...
1 parent 08438b9 commit 67061ab2ae06a35c19a586043f76344cdd81b325 @davidcornu committed May 10, 2012
Showing with 16 additions and 0 deletions.
  1. +16 −0 spec/letter_opener/delivery_method_spec.rb
@@ -166,4 +166,20 @@
plain.should include("World!")
end
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 67061ab

Please sign in to comment.