3
3
require "generators/tailwindcss/mailer/mailer_generator"
4
4
5
5
class Tailwindcss ::Generators ::MailerGeneratorTest < Rails ::Generators ::TestCase
6
- tests Rails ::Generators ::MailerGenerator
6
+ tests Tailwindcss ::Generators ::MailerGenerator
7
7
destination Dir . mktmpdir
8
8
9
9
arguments %w( Notifications invoice )
@@ -20,6 +20,36 @@ class Tailwindcss::Generators::MailerGeneratorTest < Rails::Generators::TestCase
20
20
assert_match %r(app/views/notifications_mailer/invoice\. text\. erb) , view
21
21
assert_match ( /\= @greeting/ , view )
22
22
end
23
+
24
+ assert_file "app/views/layouts/mailer.text.erb" do |view |
25
+ assert_match ( "<%= yield %>" , view )
26
+ end
27
+
28
+ assert_file "app/views/layouts/mailer.html.erb" do |view |
29
+ assert_match ( "<%= yield %>" , view )
30
+ end
31
+ end
32
+
33
+ test "generates correct mailer view templates with namespace" do
34
+ run_generator [ "admin/notifications" , "invoice" ]
35
+
36
+ assert_file "app/views/admin/notifications_mailer/invoice.html.erb" do |view |
37
+ assert_match %r(app/views/admin/notifications_mailer/invoice\. html\. erb) , view
38
+ assert_match ( /\= @greeting/ , view )
39
+ end
40
+
41
+ assert_file "app/views/admin/notifications_mailer/invoice.text.erb" do |view |
42
+ assert_match %r(app/views/admin/notifications_mailer/invoice\. text\. erb) , view
43
+ assert_match ( /\= @greeting/ , view )
44
+ end
45
+
46
+ assert_file "app/views/layouts/admin/mailer.text.erb" do |view |
47
+ assert_match ( "<%= yield %>" , view )
48
+ end
49
+
50
+ assert_file "app/views/layouts/admin/mailer.html.erb" do |view |
51
+ assert_match ( "<%= yield %>" , view )
52
+ end
23
53
end
24
54
end
25
55
0 commit comments