File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
railties/lib/rails/generators/test_unit/scaffold Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,16 @@ def virtual?(name)
63
63
attribute = attributes . find { |attr | attr . name == name }
64
64
attribute &.virtual?
65
65
end
66
+
67
+ def datetime? ( name )
68
+ attribute = attributes . find { |attr | attr . name == name }
69
+ attribute &.type == :datetime
70
+ end
71
+
72
+ def time? ( name )
73
+ attribute = attributes . find { |attr | attr . name == name }
74
+ attribute &.type == :time
75
+ end
66
76
end
67
77
end
68
78
end
Original file line number Diff line number Diff line change @@ -35,6 +35,8 @@ class <%= class_name.pluralize %>Test < ApplicationSystemTestCase
35
35
<%- attributes_hash.each do |attr, value| -%>
36
36
<%- if boolean?(attr) -%>
37
37
check "<%= attr.humanize %>" if <%= value %>
38
+ <%- elsif datetime?(attr) || time?(attr) -%>
39
+ fill_in "<%= attr.humanize %>", with: <%= value %>.to_s
38
40
<%- else -%>
39
41
fill_in "<%= attr.humanize %>", with: <%= value %>
40
42
<%- end -%>
You can’t perform that action at this time.
0 commit comments