ensl.org/spec/support/features/form_helpers.rb

27 lines
716 B
Ruby
Raw Normal View History

module Features
module FormHelpers
def fill_form(model, hash)
hash.each do |attribute, value|
2015-11-08 09:41:11 +00:00
fill_in attribute_translation(model, attribute), with: value
end
end
2020-03-26 01:58:59 +00:00
def fill_tinymce(element = first, contents)
page.execute_script("tinymce.editors[0].setContent('#{contents}')")
# page.execute_script("tinymce.get('#{element}').setContent('#{contents}')")
end
def submit(model, action)
helper_translation(model, action)
end
def attribute_translation(model, attribute)
I18n.t("activerecord.attributes.#{model}.#{attribute}")
end
def helper_translation(model, action)
I18n.t("helpers.submit.#{model}.#{action}")
end
end
end