File tree Expand file tree Collapse file tree 3 files changed +35
-0
lines changed
lib/generators/tailwindcss/controller
test/lib/generators/tailwindcss Expand file tree Collapse file tree 3 files changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ require "rails/generators/erb/controller/controller_generator"
2
+
3
+ module Tailwindcss
4
+ module Generators
5
+ class ControllerGenerator < Erb ::Generators ::ControllerGenerator
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
+ <div>
2
+ <h1 class="text-xl font-bold"><%= class_name %>#<%= @action %></h1>
3
+ <p>Find me in <%= @path %></p>
4
+ <div>
Original file line number Diff line number Diff line change
1
+ require "test_helper"
2
+ require "generators/tailwindcss/controller/controller_generator"
3
+
4
+ class Tailwindcss ::Generators ::ControllerGeneratorTest < Rails ::Generators ::TestCase
5
+ GENERATION_PATH = File . expand_path ( "../controller_tmp" , File . dirname ( __FILE__ ) )
6
+
7
+ tests Tailwindcss ::Generators ::ControllerGenerator
8
+ destination GENERATION_PATH
9
+
10
+ arguments %w( Messages index show )
11
+
12
+ Minitest . after_run do
13
+ FileUtils . rm_rf GENERATION_PATH
14
+ end
15
+
16
+ test "generates correct view templates" do
17
+ run_generator
18
+ assert_file "app/views/messages/index.html.erb"
19
+ assert_file "app/views/messages/show.html.erb"
20
+ end
21
+ end
22
+
You can’t perform that action at this time.
0 commit comments