@@ -771,7 +771,10 @@ def foo
771
771
772
772
get "/rails/mailers/notifier/foo"
773
773
assert_equal 200 , last_response . status
774
- assert_match %r[<iframe name="messageBody"] , last_response . body
774
+ assert_match %[<iframe name="messageBody"] , last_response . body
775
+ assert_match %[<dt>Attachments:</dt>] , last_response . body
776
+ assert_no_match %[Inline:] , last_response . body
777
+ assert_match %[<a download="pixel.png" href="data:application/octet-stream;charset=utf-8;base64,iVBORw0K] , last_response . body
775
778
776
779
get "/rails/mailers/notifier/foo?part=text/plain"
777
780
assert_equal 200 , last_response . status
@@ -819,7 +822,10 @@ def foo
819
822
820
823
get "/rails/mailers/notifier/foo"
821
824
assert_equal 200 , last_response . status
822
- assert_match %r[<iframe name="messageBody"] , last_response . body
825
+ assert_match %[<iframe name="messageBody"] , last_response . body
826
+ assert_match %[<dt>Attachments:</dt>] , last_response . body
827
+ assert_no_match %[Inline:] , last_response . body
828
+ assert_match %[<a download="pixel.png" href="data:application/octet-stream;charset=utf-8;base64,iVBORw0K] , last_response . body
823
829
824
830
get "/rails/mailers/notifier/foo?part=text/plain"
825
831
assert_equal 200 , last_response . status
@@ -838,7 +844,7 @@ class Notifier < ActionMailer::Base
838
844
839
845
840
846
def foo
841
- attachments['pixel.png'] = File.binread("#{ app_path } /public/images/pixel.png")
847
+ attachments.inline ['pixel.png'] = File.binread("#{ app_path } /public/images/pixel.png")
842
848
843
849
end
844
850
end
@@ -865,7 +871,9 @@ def foo
865
871
866
872
get "/rails/mailers/notifier/foo"
867
873
assert_equal 200 , last_response . status
868
- assert_match %r[<iframe name="messageBody"] , last_response . body
874
+ assert_match %[<iframe name="messageBody"] , last_response . body
875
+ assert_match %[<dt>Attachments:</dt>] , last_response . body
876
+ assert_match %r[\( Inline:\s +<a download="pixel.png" href="data:application/octet-stream;charset=utf-8;base64,iVBORw0K] , last_response . body
869
877
870
878
get "/rails/mailers/notifier/foo?part=text/plain"
871
879
assert_equal 200 , last_response . status
@@ -875,6 +883,10 @@ def foo
875
883
assert_equal 200 , last_response . status
876
884
assert_match %r[<p>Hello, World!</p>] , last_response . body
877
885
assert_match %r[src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEWzIioca/JlAAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJgggo="] , last_response . body
886
+
887
+ get "/rails/mailers/download/notifier/foo"
888
+ email = Mail . read_from_string ( last_response . body )
889
+ assert_equal "inline; filename=pixel.png" , email . attachments . inline [ "pixel.png" ] . content_disposition
878
890
end
879
891
880
892
test "multipart mailer preview with attached email" do
@@ -923,7 +935,10 @@ def foo
923
935
924
936
get "/rails/mailers/notifier/foo"
925
937
assert_equal 200 , last_response . status
926
- assert_match %r[<iframe name="messageBody"] , last_response . body
938
+ assert_match %[<iframe name="messageBody"] , last_response . body
939
+ assert_match %[<dt>Attachments:</dt>] , last_response . body
940
+ assert_no_match %[Inline:] , last_response . body
941
+ assert_match %[<a download="message.eml" href="data:application/octet-stream;charset=utf-8;base64,RGF0ZTog] , last_response . body
927
942
928
943
get "/rails/mailers/notifier/foo?part=text/plain"
929
944
assert_equal 200 , last_response . status
0 commit comments