@@ -58,4 +58,42 @@ def test_that_it_uses_alt_types
5858
5959 assert File . exist? ( "test/tmp/concepts/application/representable/index.rb" )
6060 end
61+
62+ def test_that_it_generates_the_full_batch
63+ TrailblazerWizard . generate ( "TestModel" , full : true )
64+
65+ assert File . exist? ( "test/tmp/concepts/test_model/operation/index.rb" )
66+ assert File . exist? ( "test/tmp/concepts/test_model/operation/show.rb" )
67+ assert File . exist? ( "test/tmp/concepts/test_model/operation/create.rb" )
68+ assert File . exist? ( "test/tmp/concepts/test_model/operation/update.rb" )
69+ assert File . exist? ( "test/tmp/concepts/test_model/operation/destroy.rb" )
70+ assert File . exist? ( "test/tmp/concepts/test_model/form/create.rb" )
71+ assert File . exist? ( "test/tmp/concepts/test_model/form/update.rb" )
72+ assert File . exist? ( "test/tmp/concepts/test_model/view/index.rb" )
73+ assert File . exist? ( "test/tmp/concepts/test_model/view/show.rb" )
74+ assert File . exist? ( "test/tmp/concepts/test_model/finder/base.rb" )
75+ end
76+
77+ def test_that_it_generates_the_full_batch_with_context
78+ TrailblazerWizard . generate ( "TestModel" , full : true , context : :admin )
79+
80+ assert File . exist? ( "test/tmp/concepts/test_model/admin/operation/index.rb" )
81+ assert File . exist? ( "test/tmp/concepts/test_model/admin/operation/show.rb" )
82+ assert File . exist? ( "test/tmp/concepts/test_model/admin/operation/create.rb" )
83+ assert File . exist? ( "test/tmp/concepts/test_model/admin/operation/update.rb" )
84+ assert File . exist? ( "test/tmp/concepts/test_model/admin/operation/destroy.rb" )
85+ assert File . exist? ( "test/tmp/concepts/test_model/admin/form/create.rb" )
86+ assert File . exist? ( "test/tmp/concepts/test_model/admin/form/update.rb" )
87+ assert File . exist? ( "test/tmp/concepts/test_model/admin/view/index.rb" )
88+ assert File . exist? ( "test/tmp/concepts/test_model/admin/view/show.rb" )
89+ assert File . exist? ( "test/tmp/concepts/test_model/admin/finder/base.rb" )
90+ end
91+
92+ def test_that_it_ignores_full_generation_if_arg_is_false
93+ error = assert_raises StandardError do
94+ TrailblazerWizard . generate ( "TestModel" , full : false , context : :admin )
95+ end
96+
97+ assert_equal "[actions] arg is required" , error . message
98+ end
6199end
0 commit comments