File tree 6 files changed +50
-2
lines changed
lib/generators/tailwindcss
test/lib/generators/tailwindcss
6 files changed +50
-2
lines changed Original file line number Diff line number Diff line change 1
1
<div>
2
- <h1 class="text-xl font-bold"><%= class_name %>#<%= @action %></h1>
2
+ <h1 class="text-lg font-bold text-4xl "><%= class_name %>#<%= @action %></h1>
3
3
<p>Find me in <%= @path %></p>
4
4
<div>
Original file line number Diff line number Diff line change
1
+ require "rails/generators/erb/mailer/mailer_generator"
2
+
3
+ module Tailwindcss
4
+ module Generators
5
+ class MailerGenerator < Erb ::Generators ::MailerGenerator
6
+ source_root File . expand_path ( "../templates" , __FILE__ )
7
+ end
8
+ end
9
+ end
Original file line number Diff line number Diff line change
1
+ <h1><%= class_name %>#<%= @action %></h1>
2
+
3
+ <p>
4
+ <%%= @greeting %>, find me in <%= @path %>
5
+ </p>
Original file line number Diff line number Diff line change
1
+ <%= class_name %>#<%= @action %>
2
+
3
+ <%%= @greeting %>, find me in <%= @path %>
Original file line number Diff line number Diff line change 38
38
39
39
<% end -%>
40
40
<div class="inline">
41
- <%%= form.submit class: "rounded-lg py-3 px-5 bg-blue-600 text-white inline-block font-medium" %>
41
+ <%%= form.submit class: "rounded-lg py-3 px-5 bg-blue-600 text-white inline-block font-medium cursor-pointer " %>
42
42
</div>
43
43
<%% end %>
Original file line number Diff line number Diff line change
1
+ require "test_helper"
2
+ require "rails/generators/mailer/mailer_generator"
3
+ require "generators/tailwindcss/mailer/mailer_generator"
4
+
5
+ class Tailwindcss ::Generators ::MailerGeneratorTest < Rails ::Generators ::TestCase
6
+ GENERATION_PATH = File . expand_path ( "../mailer_tmp" , File . dirname ( __FILE__ ) )
7
+
8
+ tests Rails ::Generators ::MailerGenerator
9
+ destination GENERATION_PATH
10
+
11
+ arguments %w( Notifications invoice )
12
+
13
+ Minitest . after_run do
14
+ FileUtils . rm_rf GENERATION_PATH
15
+ end
16
+
17
+ test "generates correct mailer view templates" do
18
+ run_generator
19
+
20
+ assert_file "app/views/notifications_mailer/invoice.html.erb" do |view |
21
+ assert_match %r(app/views/notifications_mailer/invoice\. html\. erb) , view
22
+ assert_match ( /\= @greeting/ , view )
23
+ end
24
+
25
+ assert_file "app/views/notifications_mailer/invoice.text.erb" do |view |
26
+ assert_match %r(app/views/notifications_mailer/invoice\. text\. erb) , view
27
+ assert_match ( /\= @greeting/ , view )
28
+ end
29
+ end
30
+ end
31
+
You can’t perform that action at this time.
0 commit comments