spec/mailit/mail.rb in mailit-2010.06.03 vs spec/mailit/mail.rb in mailit-2011.01.27

- old
+ new

@@ -1,7 +1,7 @@ # Encoding: UTF-8 -require 'spec/helper' +require File.expand_path(File.join(File.dirname(__FILE__), '..', 'helper')) # The specs are translated from the Test::Unit tests of MailFactory. # # TODO: # * test_attach_as @@ -99,36 +99,36 @@ mail = Mailit::Mail.new mail.to = "test@test.com" mail.from = "test@othertest.com" mail.subject = "some html" - mail.html = "<a href=\"http://google.com\">click here</a>" + mail.html = '<a href="http://google.com">click here</a>' mail.to_s.should.include('<a href=3D"http://google.com">click here</a>') end - + should 'make mail with a single attachment' do mail = Mailit::Mail.new tempfile = Tempfile.new('adw') tempfile << "Some text" mail.attach(tempfile.path) mail.attachments.size.should == 1 mail.attachments.first[:attachment].should.be == tempfile.read mail.attachments.first[:filename].should == Pathname.new(tempfile.path).basename end - + should 'make mail with a single attachment and given filename' do mail = Mailit::Mail.new tempfile = Tempfile.new('adw') filename = "tempfile.pdf" tempfile << "Some text" mail.attach_as(tempfile.path, filename) mail.attachments.size.should == 1 mail.attachments.first[:attachment].should.be == tempfile.read mail.attachments.first[:filename].should == filename end - + should 'make mail with multiple attachments and given filenames' do mail = Mailit::Mail.new tempfile1 = Tempfile.new('adw') tempfile1 << "Hello" tempfile1_filename = "tempfile1.pdf" @@ -141,7 +141,6 @@ mail.attachments[0][:attachment].should.be == tempfile1.read mail.attachments[0][:filename].should == tempfile1_filename mail.attachments[1][:attachment].should.be == tempfile2.read mail.attachments[1][:filename].should == tempfile2_filename end - end