Merge pull request #49409 from stevepolitodesign/sp-datetime-local-scaffold
Ensure system test scaffold supports `datetime` and `time` attributes
This commit is contained in:
commit
9cb6f443d4
@ -63,6 +63,16 @@ def virtual?(name)
|
||||
attribute = attributes.find { |attr| attr.name == name }
|
||||
attribute&.virtual?
|
||||
end
|
||||
|
||||
def datetime?(name)
|
||||
attribute = attributes.find { |attr| attr.name == name }
|
||||
attribute&.type == :datetime
|
||||
end
|
||||
|
||||
def time?(name)
|
||||
attribute = attributes.find { |attr| attr.name == name }
|
||||
attribute&.type == :time
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -35,6 +35,8 @@ class <%= class_name.pluralize %>Test < ApplicationSystemTestCase
|
||||
<%- attributes_hash.each do |attr, value| -%>
|
||||
<%- if boolean?(attr) -%>
|
||||
check "<%= attr.humanize %>" if <%= value %>
|
||||
<%- elsif datetime?(attr) || time?(attr) -%>
|
||||
fill_in "<%= attr.humanize %>", with: <%= value %>.to_s
|
||||
<%- else -%>
|
||||
fill_in "<%= attr.humanize %>", with: <%= value %>
|
||||
<%- end -%>
|
||||
|
Loading…
Reference in New Issue
Block a user