File tree Expand file tree Collapse file tree 5 files changed +52
-6
lines changed
Expand file tree Collapse file tree 5 files changed +52
-6
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ def exec(*)
6767 aliases : "-e" ,
6868 enum : %w[ development test production ]
6969 def _run ( *files )
70+ # :nocov:
7071 dotenvs = [ ".env.#{ options [ :env ] } " , ".env" ]
7172 CLI . load_dotenv_files ( *dotenvs )
7273
@@ -76,10 +77,12 @@ def _run(*files)
7677 if File . exist? ( file )
7778 load file
7879 else
79- say_error "ERROR: File not found: #{ file } "
80+ relative_path = Pathname ( file ) . relative_path_from ( Pathname . pwd )
81+ say_error "ERROR: File not found: #{ relative_path } "
8082 exit 1
8183 end
8284 end
85+ # :nocov:
8386 end
8487
8588 map "g" => "generate"
Original file line number Diff line number Diff line change @@ -678,11 +678,7 @@ def error(attr, **attrs)
678678 attrs [ :placeholder ] ||=
679679 translation_for ( :placeholder , attr , default : false )
680680
681- helper_name = if type == :checkbox
682- :"#{ type } _tag"
683- else
684- :"#{ type } _field_tag"
685- end
681+ helper_name = :"#{ type } _field_tag"
686682
687683 send helper_name ,
688684 name_for ( attr ) ,
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ puts "running file!"
Original file line number Diff line number Diff line change @@ -516,4 +516,24 @@ class FailedTest < Zee::Test
516516 assert_includes out , "Hello from my runner!"
517517 assert_includes out , "Hello from another runner!"
518518 end
519+
520+ test "fails when running missing ruby file" do
521+ slow_test
522+
523+ exit_code = nil
524+ err = nil
525+
526+ Dir . chdir ( "test/fixtures/sample_app" ) do
527+ capture ( shell : true ) do
528+ system "../../../exe/zee" ,
529+ *%w[
530+ run
531+ doesnt_exist.rb
532+ ]
533+ end => { exit_code :, err :}
534+ end
535+
536+ assert_equal 1 , exit_code
537+ assert_includes err , "ERROR: File not found: doesnt_exist.rb"
538+ end
519539end
Original file line number Diff line number Diff line change @@ -1123,4 +1123,28 @@ def capture(&)
11231123
11241124 assert_html html , "div.field[data-testid='name_field']"
11251125 end
1126+
1127+ test "renders field for checkbox" do
1128+ store_translations :en ,
1129+ zee : {
1130+ forms : {
1131+ user : {
1132+ admin : {
1133+ label : "Admin permission" ,
1134+ hint : "User can manage things and users"
1135+ }
1136+ }
1137+ }
1138+ }
1139+ user = { }
1140+ template = <<~ERB
1141+ <%= form_for user , url : "/users" , as : :user do |f | %>
1142+ <%= f . field :admin , type : :checkbox %>
1143+ <% end %>
1144+ ERB
1145+ html = render ( template , locals : { user :} , request :)
1146+
1147+ assert_html html , "div.field>div.field-controls+div.field-info"
1148+ assert_html html , "div.field-info>label.label+.hint"
1149+ end
11261150end
You can’t perform that action at this time.
0 commit comments